Closed systemsoverload closed 3 months ago
Fwiw, we basically ported https://github.com/fannheyward/coc-pyright/blob/6011417adce4098438a66883a2d03bea4a4d68d7/src/configSettings.ts#L47-L114. But I do think your proposal makes more sense.
I use Rye too and have the same issue. The main issue here is with this commit you do not check the return code of the subprocess anymore!
So before (with check_output
) it raised an exception, which was caught, and it continued to the venv detection code.
Now it fails silently, so it triggers the return:
I use Rye too and have the same issue. The main issue here is with this commit you do not check the return code of the subprocess anymore!
That commit is even after this issue was filed.
Fwiw, we basically ported fannheyward/coc-pyright@
6011417
/src/configSettings.ts#L47-L114. But I do think your proposal makes more sense.
As I stated.
True! So my issue is slightly different since in my case it worked before this commit, i.e. before the last release (I use Rye but I do not have pyenv installed). But fixing this one would solve my issue too because it would use the .venv
and never try to use pyenv.
I guess because https://github.com/fannheyward/coc-pyright/blob/6011417adce4098438a66883a2d03bea4a4d68d7/src/configSettings.ts#L54-L57 so coc-pyright works. But that most likely won't fit how ST users use ST.
I guess should add .venv
folder as a special case (for better UX) as the highest priority.
I think it makes sense to search "arbitrary" subfolders to find a virtual env as the last help as in https://github.com/sublimelsp/LSP-pyright/blob/7d9269b0400eb2129e351f3a63f80f6704f4409c/plugin.py#L245-L251
The strategy coc-pyright used now is basically rely on env variables. Unfortunately that won't work well in ST since env variables are the same for all windows and last until ST gets closed. Plus, if a user (especially on Windows) used to click ST icon to start ST, the env-variable-way just won't work.
That works too! Actually a config like this is the first thing I looked for.
That works too! Actually a config like this is the first thing I looked for.
In the next release (probably the day after tomorrow), you can decide how venv is resolved.
By default, .venv
at the project root (i.e., local_dot_venv
) is preferred. https://github.com/sublimelsp/LSP-pyright/blob/bab20e63ab45e6eaf317fe07cef088f1e478e50e/LSP-pyright.sublime-settings#L20-L32
Update: I change the settings name from pyright.venv.strategies
to venvStrategies
.
Expected:
Projects with a
.venv
should always have python loaded from this directory.Actual:
Projects that have a
.venv
directory in the base of the project as well as a.python-version
file in the base of project default to the commandpyenv which python {version from .python-version}
to resolve the venv and ignore the local venv.This layout is the default behavior of Rye managed projects.