code-server icon indicating copy to clipboard operation
code-server copied to clipboard

[Bug]: Code jump (ctrl+click) slowly or not working in python project

Open wqhcug opened this issue 1 year ago • 10 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

OS/Web Information

  • Web Browser: google 88.0.4324.104
  • Local OS: WIN10
  • Remote OS: Ubuntu 16.04
  • Remote Architecture: X86
  • code-server --version:
    code-server: v4.8.3 Code: 1.72.1 -python:3.9

Steps to Reproduce

  1. Use ctrl+click jump to source code slowly in python project
  2. Use ctrl+click slowly to source code not working in python project

Expected

Use ctrl+click jump to source code immediately

Actual

  1. Use ctrl+click jump to source code slowly in python project
  2. Use ctrl+click slowly to source code not working in python project

Logs

No response

Screenshot/Video

No response

Does this issue happen in VS Code or GitHub Codespaces?

  • [X] I cannot reproduce this in VS Code.
  • [X] I cannot reproduce this in GitHub Codespaces.

Are you accessing code-server over HTTPS?

  • [X] I am using HTTPS.

Notes

No response

wqhcug avatar Jul 07 '23 03:07 wqhcug

Does this reproduce in the latest version of code-server (v4.14.1)?

I launched v4.14.1, installed the Python extension, and opened a Python project (Django) but Ctrl+click works normally for me. I am not seeing any slowness either.

code-asher avatar Jul 13 '23 22:07 code-asher

Odd, I'm also seeing the same issue as the OP. here's my setup: python 3.11.4 code-server 4.14.1 - codercom/code-server:4.14.1-ubuntu (vscode 1.79.2) python extension v2023.12.0

For now I can tell that highlight, ctrl+click and intellisense are not working. I have the same project and versions on a local environment, working just fine on vscode 1.80.1.

I've tried downgrading the python extension to 2023.10.1, 2023.10.0 and 2023.8.0, but I have the same issues.

I've also tried creating a new project using poetry and setting up pyenv with virtual environment. Same issue when selecting the python interpreter from the environment.

I've tried setting "python.autoComplete.extraPaths" to the site-packages of the virtual environment and reloading the code-server. Same issue.

gcarrarom avatar Jul 20 '23 14:07 gcarrarom

I Can reproduce this issue by doing the following:

  1. create a new container using docker run -p 8080:8080 codercom/code-server:4.14.1-ubuntu
  2. connecting via browser using the default generated password.
  3. installing the python extension: ms-python v2023.12.0
  4. installing python: 4.1. sudo apt update 4.2. sudo apt install python3 4.3. sudo apt install python3-pip
  5. install a python package. i.e.: pip install click
  6. In the python file created, and the new python installed, try to import the installed package: import click
  7. Try to use intellisense:

CleanShot 2023-07-20 at 10 38 25

The interesting part is that the module gets identified: CleanShot 2023-07-20 at 10 39 12

Just doesn't do anything after:

CleanShot 2023-07-20 at 10 39 28

Everything else works just fine: (aoo.py) - yes, that's a typo :)

import click

@click.command()
def something():
    click.echo("something")

if __name__ == '__main__':
    something()

Can be used just fine:

coder@e27da99b72c6:~$ python3 ./aoo.py 
something
coder@e27da99b72c6:~$ 

gcarrarom avatar Jul 20 '23 14:07 gcarrarom

Does the problem still exist? I had the same problem, python Built-in modules and self-written modules work properly and can jump. However, third-party modules do not take effect.
venv interpreter is in my working directory.
I carried out the extraPaths configuration, but still couldn't auto complete and jump the third-party module normally:

"python.autoComplete.extraPaths": [
        "/root/test-projcet/venv3/venv3/lib/python3.11/site-packages",
    ]

Am I missing something?

Gu-f avatar Jul 21 '23 17:07 Gu-f

Still happening. I'll update to the new version and try again to see how it goes and report back.

gcarrarom avatar Jul 23 '23 18:07 gcarrarom

Nope, still happening on 4.15.0 (code 1.80.1). Built-in works just fine, it's just the 3rd party modules as you've stated, @Gu-f.

gcarrarom avatar Jul 23 '23 18:07 gcarrarom

Thank you for the reproduction @gcarrarom. I followed the steps (well except I added --auth none so I skipped the second step).

I ran it a number of times with the steps in different orders and sometimes it seems to break and sometimes it works but nothing seems to consistently reproduce it for me. Reloading the page so far always fixes mine though. Is it the same for you?

code-asher avatar Jul 28 '23 18:07 code-asher

Hey, thanks for testing it out!

Just tried here and it won't work. I've tried the following on Chrome, Edge and Firefox:

  1. Opening up a code window
  2. Installed python click
  3. wrote some code
  4. ran just fine - checked the interpreter version, same as the runtime on the terminal
  5. reloaded multiple times - never worked.

Here are the versions of the browsers: Edge: Version 115.0.1901.188 (Official build) (arm64) Chrome: Version 115.0.5790.114 (Official Build) (arm64) Firefox: Version 115.0.2 (64-bit) Safari: Version 17.0 (19616.1.24.11.3)

Makes me wonder what could be happening. Doesn't seem to be browser related. Although... That's my environment, let's try the one I sent you for reproducing the issue...

EDIT: Turns out refreshing does fix it for the environment that reproduces the error. I wonder why my other environment - with my code and other packages - doesn't refresh the same way on page reload! I'll try to see if I can find some logs that could help.

gcarrarom avatar Jul 28 '23 20:07 gcarrarom

Looking at the logs now, here's the one running that simple base image with only that python click file:

[IPC Library: Pty Host] DEBUG CommandDetectionCapability#handlePromptStart 0 125
[IPC Library: Pty Host] DEBUG CommandDetectionCapability#handleCommandStart 22 125
[IPC Library: Pty Host] DEBUG ChildProcessMonitor: Has child processes changed false
[20:34:30] [172.17.0.1][e2374c86][ManagementConnection] The client has disconnected gracefully, so the connection will be disposed.
[2023-07-28T20:34:30.372Z] debug Deleting session from session registry: /tmp/vscode-ipc-26b49b48-0667-4736-955f-7a07eae43035.sock
[2023-07-28T20:34:30.372Z] debug Deleting session from session registry: /tmp/vscode-ipc-26b49b48-0667-4736-955f-7a07eae43035.sock
[20:34:30] [172.17.0.1][4fa0fd2b][ExtensionHostConnection] <66> Extension Host Process exited with code: 0, signal: null.
File not found: /usr/lib/code-server/lib/vscode/out/vsda.js
File not found: /usr/lib/code-server/lib/vscode/out/vsda_bg.wasm
[20:34:30] [172.17.0.1][11c2d579][ManagementConnection] New connection established.
[2023-07-28T20:34:30.993Z] debug got latest version {"latest":"4.15.0"}
[2023-07-28T20:34:30.994Z] debug comparing versions {"current":"4.15.0","latest":"4.15.0"}
[20:34:31] Error while reading the extension cache file: /home/coder/.local/share/code-server/CachedProfilesData/__default__profile__/extensions.user.cache Unable to read file '/home/coder/.local/share/code-server/CachedProfilesData/__default__profile__/extensions.user.cache' (Error: Unable to resolve nonexistent file '/home/coder/.local/share/code-server/CachedProfilesData/__default__profile__/extensions.user.cache')
[20:34:31] Using cached extensions scan result file:///usr/lib/code-server/lib/vscode/extensions
[20:34:31] [172.17.0.1][552cc092][ExtensionHostConnection] New connection established.
[20:34:31] [172.17.0.1][552cc092][ExtensionHostConnection] <1360> Launched Extension Host Process.
[IPC Library: Pty Host]  INFO Expanding terminal instance, old id 1 -> new id undefined
[2023-07-28T20:34:31.914Z] debug Adding session to session registry: /tmp/vscode-ipc-f42b4680-7376-4cbc-a16e-dcdb898189bc.sock

Then my environment:

[16:27:17] [10.42.2.11][ad3ce178][ManagementConnection] The client has disconnected gracefully, so the connection will be disposed.
[2023-07-28T20:27:17.672Z] debug Deleting session from session registry: /tmp/vscode-ipc-dc39adec-4639-413c-8f5a-773df60eef2d.sock
[2023-07-28T20:27:17.672Z] debug Deleting session from session registry: /tmp/vscode-ipc-dc39adec-4639-413c-8f5a-773df60eef2d.sock
[16:27:17] [10.42.0.224][2c9b588f][ExtensionHostConnection] <24692> Extension Host Process exited with code: 0, signal: null.
File not found: /usr/lib/code-server/lib/vscode/out/vsda_bg.wasm
File not found: /usr/lib/code-server/lib/vscode/out/vsda.js
[16:27:17] [10.42.5.11][a6c06a7a][ManagementConnection] New connection established.
[2023-07-28T20:27:18.084Z] debug got latest version {"latest":"4.15.0"}
[2023-07-28T20:27:18.084Z] debug comparing versions {"current":"4.15.0","latest":"4.15.0"}
[16:27:18] Using cached extensions scan result file:///usr/lib/code-server/lib/vscode/extensions
[16:27:18] Using cached extensions scan result file:///root/.local/share/code-server/extensions/extensions.json
[16:27:18] [10.42.2.11][edbd8ef0][ExtensionHostConnection] New connection established.
[16:27:18] [10.42.2.11][edbd8ef0][ExtensionHostConnection] <25618> Launched Extension Host Process.
[2023-07-28T20:27:19.069Z] debug Adding session to session registry: /tmp/vscode-ipc-ec31cf0d-8f40-4398-b41c-eaa731e7c5fc.sock

Nothing that suggests any differences here.

EDIT: I'm starting to see some differences here. Especially on the missing 'ChildProcessMonitor: Has child processes changed false'. This could mean that I still have some lingering child processes that could be holding off the reload of the extension? Wouldn't then the container restart take care of that? Sorry, I don't know where to go from here now.

gcarrarom avatar Jul 28 '23 20:07 gcarrarom

I am not familiar enough with the internals to say offhand for sure whether that is related. Nothing else stands out to me either. Maybe there are more logs in the browser console though.

Something you might try is to load your code in local/native VS Code, VS Code remote (if you have SSH access), and in the simple base image to see if it reproduces in any of those settings to possibly rule out code-server and/or the environment. Best case is if it reproduces in VS Code or with the remote extension because then we can raise it upstream to get more knowledgeable help.

If the code and/or environment is something you can share I will try it out to see if it reproduces for me.

code-asher avatar Jul 31 '23 20:07 code-asher

Closing as stale and probably an upstream issue but feel free to comment if you come back to this.

code-asher avatar Jul 12 '24 23:07 code-asher