-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
language server doesn't see packages installed in venv #111
Comments
For Pyright to work correctly, it needs to be passed the interpreter path. For the language server, this value is derived from the IntelliJ module in which the file resides. The LSP4IJ client currently does not have access to a module, only the project. This leads to the LSP settings object being created with the interpreter path set as You can download the fix from here. Could you install it manually and see if it works for you? |
I downloaded I still see the same |
I can reproduce this with LSP4IJ but not the native client. The While debugging, I have found that specifying the virtual environment explicitly helps (this is by no mean a fix though): # pyproject.toml
[tool.pyright]
venvPath = "."
venv = ".venv" // pyrightconfig.json
{
"venvPath": ".",
"venv": ".venv"
} @angelozerr This seems to be some subtle difference between the two clients. Could you have a look? |
I am sorry wi dont understand what you want I look? More I have not ultimate so I cannot play with lsp native Is it possible to share lsp traces from LSP4IJ and lsp native to compare them? I wonder if it is a problem with workspace folder or env variables. |
@angelozerr If you haven't heard the news, RustRover, WebStorm and Rider are free for non-commercial uses. Also, the EAP is opening. In case none of those work for you, here are my logs. |
Thznks for the logs. I have noticed that with LSP4IJ rootUri from initialized params, and didOpen uri dont uses % in their uri (file:///c%3A/Users/InSync/project) although in native lsp they use this encoded uri. @InSyncWithFoo could you try to generate the same uri than lsp native with lsp4ij nighty to use the api which support customization of the uri |
@angelozerr Also, this modification should perhaps be implemented within LSP4IJ itself. While the spec does require that servers support both |
I have debugged ot and the method is called?
LSP4IJ sypports both syntax. @InSyncWithFoo I re-read the issue and it seems the problem exists with another OS (/home/beauxq/PycharmProjects/PythonProject/h.py). I have no idea why there is this different behavior |
InLSP native thereis this trace;
why not in lsp4ij? |
That's the big question: I have no idea. |
The best thing is to debug the language server, I'm sorry I will not have time to do that. |
What happened?
In the PyCharm terminal:
There's no error on the import line.
In the editor, on the first line, I have a red squiggly that says:
Import "typed_argparse" could not be resolved Pyright (reportMissingImports)
Steps to reproduce
With a new PyCharm 2024.3.1.1 (Community Edition)
(deleted
~/.config/JetBrains
and~/.local/share/JetBrains
before this)From the plugin marketplace in PyCharm, I install Pyright 0.8.0 and LSP4IJ 0.9.0
Then I create a new PyCharm project with a venv
In the PyCharm terminal, with the venv activated:
pip install pyright
pip install typed-argparse
In the project, create a new python file,
h.py
In Settings > Tools > Pyright > Project:
I set the executable to the
pyright
in the venv/home/beauxq/PycharmProjects/PythonProject/.venv/bin/pyright
I set the language server executable to the
pyright-langserver
in the venv/home/beauxq/PycharmProjects/PythonProject/.venv/bin/pyright-langserver
I set Running mode to LSP4IJ
Relevant log output or stack trace
Operating system
Linux
The text was updated successfully, but these errors were encountered: