-
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
Update pyright.lua to use cwd()
if no python config files are present.
#2697
Conversation
This behavior is more natural and the default in VS Code: microsoft/pyright#5407 (comment).
there has |
I'm not 100% this covers my use case. My use case is: a directory with stuff like
In tests/f.py, I would like to do In Vs Code this works. In Nvim I currently have to create a pyproject.toml |
if in |
no no, my Yeah we have pytypes as well as tests. |
hmm. then change your commit message force push. |
This is a bad idea. Like I mentioned in #2728 , this PR disables single-file mode entirely. You are forcing the root directory to always fallback to Neovim's current working directory even though some files are meant to be edited with the LSP launched in single-file mode without any root directory set.
Just because a behavior is the default for VS Code does not mean it is appropriate for the workflow of Neovim. Let me give you an example of why this PR is such a bad idea. Let's say I'm currently in my home directory when I launch neovim from the terminal. This will essentially set Neovim's cwd to my home directory. After neovim launches, I open a file Here's a video illustrating the workflow I just described. Pyright's root directory is set to neovim's cwd even though the file is meant to be edited in single-file mode. NoSingleFileMode.mp4Neovim is not VSCode Neovim is not VSCode. They are both different editors designed for different workflows. @glepnir |
lsp was born based on vscode. Other editors benefit from this agreement. So you can see that most editors use vscode as a reference when implementing lsp. The problem is due to a difference in the design of the editors. There is no guarantee that the behavior will be 100% consistent with vscode. pr breaks the single-file mode. Because the root directory of the cwd will be generated anyway. pyright will retrieve all pyhton files under cwd. My suggestion is to leave it as it is (remove cwd). If @hacker-DOM you need to use cwd, modify it in your local pyright. (lspconfig provides a basic server configuration. Meet the needs of most people. For individual usage scenarios. Local modifications are more appropriate) |
@glepnir |
revert or remove . |
Creating a PR to fix this now. |
This behavior is more natural and the default in VS Code: microsoft/pyright#5407 (comment).