pappasam / jedi-language-server

A Python language server exclusively for Jedi. If Jedi supports it well, this language server should too.
MIT License
596 stars 45 forks source link

Problems with Jedi in VS Code #266

Open DP1701 opened 1 year ago

DP1701 commented 1 year ago

Hi, when I switch to Jedi in VS Code, built in modules are recognised correctly but other modules (for example PyTorch) installed with pip are not.

Details can already be read here. https://github.com/microsoft/vscode-python/issues/21060#issue-1668603605

Does anyone have an idea what the problem could be?

jpele-tis commented 1 year ago

I've got the same issue here https://github.com/microsoft/vscode-python/issues/21265 So last working version on VSCode was jedi-language-server==0.34.12 used in Python extension 2021.12.*

andriati-alex commented 1 year ago

Apparently, this is not only in vscode, but I'm using neovim and algo get the same problem. Completions for builtin libs fine, but for any external package no sign

pappasam commented 1 year ago

Apparently, this is not only in vscode, but I'm using neovim and algo get the same problem. Completions for builtin libs fine, but for any external package no sign

Have you activated your virtual environment before opening Vim? I'm using neovim, just tested out completions from a 3rd party package, and things work fine for me.

andriati-alex commented 1 year ago

Apparently, this is not only in vscode, but I'm using neovim and algo get the same problem. Completions for builtin libs fine, but for any external package no sign

Have you activated your virtual environment before opening Vim? I'm using neovim, just tested out completions from a 3rd party package, and things work fine for me.

Yes, in my setup I use the Mason plugin to install the language servers, and apart from that, I have the virtual environment I work on properly activated, and yet no completions for third part packages

regob commented 10 months ago

I have the same issue with VSCode. It seems when initializing the language server options the environment is not passed. If I print the environment path where the lsp is initialized, it's None already. So I gues this should be passed somehow.

Enabling verbose mode using

sys.argv += ['-v']
sys.exit(cli())

when starting the language server in the vscode extension the messages are printed, and I don't see VSCode passing the environment anywhere


2023-11-17 11:04:44.535 [info] INFO:pygls.protocol:Language server initialized InitializeParams(... LOTS OF PARAMS ..., client_info=InitializeParamsClientInfoType(name='Visual Studio Code', version='1.84.2'), locale='en', root_path='/home/rego/.vscode-server/extensions/ms-python.python-2023.20.0', root_uri='file:///home/rego/.vscode-server/extensions/ms-python.python-2023.20.0', initialization_options={'markupKindPreferred': 'markdown', 'completion': {'resolveEagerly': False, 'disableSnippets': True}, 'diagnostics': {'enable': True, 'didOpen': True, 'didSave': True, 'didChange': True}, 'hover': {'disable': {'keyword': {'all': True}}}, 'workspace': {'extraPaths': ['/home/rego/.vscode-server/extensions/ms-python.python-2023.20.0'], 'symbols': {'maxSymbols': 0}}}, trace=<TraceValues.Off: 'off'>, work_done_token=None, workspace_folders=[WorkspaceFolder(uri='file:///home/rego/.vscode-server/extensions/ms-python.python-2023.20.0', name='ms-python.python-2023.20.0')])
rohit901 commented 9 months ago

Any fix for this? I seem to have similar problem and I have described it in https://github.com/coder/code-server/issues/6619

I hope this can be fixed..

zengziru commented 4 months ago

I have the same question!!!

davidhalter commented 4 months ago

You guys have to help us somehow with what's actually going wrong. It feels like the wrong environment is detected. But why is the wrong environment detected? What is special about your installations? How many Python versions have you installed? Are you using virtualenvs? What is your editor/IDE?

Writing "I have the same question!!!" is not helpful at all. If you want us to put in work always think of us as humans, too. Try to put in your absolute best into helping us solve the problem.

zengziru commented 4 months ago

You guys have to help us somehow with what's actually going wrong. It feels like the wrong environment is detected. But why is the wrong environment detected? What is special about your installations? How many Python versions have you installed? Are you using virtualenvs? What is your editor/IDE?

Writing "I have the same question!!!" is not helpful at all. If you want us to put in work always think of us as humans, too. Try to put in your absolute best into helping us solve the problem.

OK,I have solved the problem this afternoon, just download "Pyright" extention from vscode market, it can solve all problems. Because of the consideration of security, I have to use "code-server" to attach the server, but "Pylance" can not be used in code-server. So I have to use jedi, while it seems that it can not detect the virtual conda environment automatically... So just use "Pyright", it can solve all problems. Thank you for all efforts trying to solve the problem for almost one year.