-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Warn if pyright is started from $HOME #2971
Comments
It's #2885 that "cleaned" some configurations (#2904), but broke many others like #2975 and this one. It also broke my setup because I have a I suggest that #2885 should be reimplemented in a backward-compatible way that does not change the behavior of the old configurations. e.g. use a new function or argument for the new behavior. |
And if it does exist, then the behavior is correct. #2885 changed the behavior to be more deterministic and avoid lots of hand written code in the configs.
If you have an eslintrc in your HOME then presumably your HOME is a eslint project. |
The problem is that, almost all configurations were not using |
I think we should be able to specify that several patterns are of the same priority. |
Guessing which file format is prioritized is non-deterministic for me. |
Language server
pyright
Requested feature
The behaviour of
lspconfig.util.root_pattern
is "depth-first":nvim-lspconfig/lua/lspconfig/util.lua
Lines 251 to 262 in 7eed8b2
i.e., it checks the existence of a given
root_file
(e.g.pyproject.toml
in the current working dir), ascends as far up if it can, then tries the nextroot_file
in the current working dir.As a result, the existence of a hypothetical
~/pyproject.toml
(which, in real world situations, should probably not exist):would override any other
root_file
. Since pyright has no problems with being initiated from$HOME
, it will go on ahead, but take a very long time to init (up to 2 minutes on a convoluted macos system). A warning is produced inLspLog
, but otherwise, the user has no idea that something might be off.Short of reworking
root_pattern
to allow breadth-first search (which is, in itself, undesirable, since in the above example, setting the project root to be~/project
when working onfile2
is fairly sane behaviour), the minimum change would be to raise a warning if pyright is being started from$HOME
. In most foreseeable cases, users will not have any of the following files in$HOME
.nvim-lspconfig/lua/lspconfig/server_configurations/pyright.lua
Lines 3 to 11 in 7eed8b2
The only notable exception is
$HOME/.git
for dotfiles containing python files. Such situations are not unheard of, so I'm not sure if the warning would be useful.NB: I saw that
root_pattern
has been slated for deprecation (since 2022-08 -- #2079), but I haven't looked at the correspondingvim.fs
equivalent.Other clients which have this feature
No response
The text was updated successfully, but these errors were encountered: