-
Notifications
You must be signed in to change notification settings - Fork 25
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
How setup it to use the pyright
installed in the environment?
#95
Comments
It does not. The user must supply it. Your problem is that lsp-pyright looks for pyright in the general $PATH, not with your environment active. That is it looks for your system pythons pyright. I'm unsure as to the best solution to your problem, but it is likely either adding your poetries environment to the $PATH, or installing pyright into the system, itself, not in a venv. (though it would be possible to modify lsp-pyright to use your poetry version of pyright, I don't think it is the intended usecase) |
Lines 287 to 290 in dd54b3a
Here’s what happens when you open a Python project without an installed server:
In rare cases where NPM_CONFIG_PREFIX="$HOME/.local/" npm install -g pyright Don't forget to add For As far as I can tell, To properly answer the question "How can I tell lsp-pyright to use the installed pyright?", we first need to understand the search paths used by Emacs when calling It seems likely that after installing the Python version of the LSP server implementation, it ends up somewhere deep inside I’d also recommend using a more standard approach—the Node.js implementation of the server. With it, you’ll have a single, centralized installation that doesn’t need to be set up separately for each project. There’s no need to manage its updates or configure search paths manually. Additionally, as far as I can tell, the Node.js implementation is the most complete version of the server. |
I have this example code:
I have no errors in the editor, but if I install pyright manually and run the command I have the expected error
How can I tell to
lsp-pyright
to use the installedpyright
?I have this configuration in my
.emacs
Also I'm using poetry as the package manager for my projects, and
poetry.el
package. I activate the environment byM-x poetry RET v
and restart the lsp withlsp-workspace-restart
I guess
lsp-pyright
install its own version of pyright, but couldn't found by looking into the elisp codeI'm also using
poetry config virtualenvs.in-project true
, which make poetry create the virtual environment at.venv
. When I ranM-: (lsp-pyright-locate-venv)
I receive"~/code/mypyproject/.venv"
in the minibuffer, but still no error reporting for the protocol implementation.Note: This may be an Y/X problem. I want to have the proper error message (X) and I believe the problem that the plugin is using whatever other version of
pyright
that is not the same of the command line(Y), but maybe Y is not the caseThe text was updated successfully, but these errors were encountered: