Skip to content
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

Configuration file setting is ignored for LSP4IJ mode #66

Open
fkrauthan opened this issue Aug 26, 2024 · 5 comments
Open

Configuration file setting is ignored for LSP4IJ mode #66

fkrauthan opened this issue Aug 26, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@fkrauthan
Copy link

fkrauthan commented Aug 26, 2024

What happened?

When using the LSP4IJ mode the language server is ignoring the Configuration file I manually set and instead uses a pyproject.toml in the root of my project.

Steps to reproduce

  1. Create pyproject.toml` without any pyright specific settings
  2. Create a subfolder my_sub and create a pyrightconfig.json file
  3. Set the Pyright (Project) -> Configuration setting to my_sub/pyrightconfig.json
  4. Set the Running mode to LSP4IJ`
  5. Open a python file and look at the Language Server Logs.

Relevant log output or stack trace

Server root directory: file:///Users/florian.krauthan/.cache/pyright-python/1.1.377/node_modules/pyright/dist
Pyright language server 1.1.377 starting
Starting service instance "..."
Loading pyproject.toml file at /Users/florian.krauthan/Projects/.../pyproject.toml
Pyproject file "/Users/florian.krauthan/Projects/.../pyproject.toml" has no "[tool.pyright]" section.
Auto-excluding **/__pycache__
Auto-excluding **/node_modules
Auto-excluding **/.*
No include entries specified; assuming /Users/florian.krauthan/Projects/...
Auto-excluding /Users/florian.krauthan/Projects/.../my_sub/venv
Found 831 source files

Operating system

macOS

@fkrauthan fkrauthan added the bug Something isn't working label Aug 26, 2024
@fkrauthan
Copy link
Author

Console mode works as expected

@InSyncWithFoo
Copy link
Owner

This is expected. Pyright's LSP mode does not support explicit explicit configuration file. See this discussion. You can file an enhancement request for Pyright, though.

@InSyncWithFoo InSyncWithFoo closed this as not planned Won't fix, can't repro, duplicate, stale Aug 26, 2024
@fkrauthan
Copy link
Author

fkrauthan commented Aug 26, 2024

Could you not add a working directory setting to the plugin that would be used for executing the language server and the command line? Instead of running it from the project root. At least for my use-case that would solve the issue.

@InSyncWithFoo InSyncWithFoo added enhancement New feature or request and removed bug Something isn't working labels Aug 27, 2024
@InSyncWithFoo
Copy link
Owner

InSyncWithFoo commented Aug 27, 2024

That wouldn't work, since LSP mode uses workspace folders and not the working directory. You can try the build out yourself to verify this.

LSP4IJ, which is the client this plugin is using, has yet to support workspace folders, so I'm afraid you will have to wait. I wonder if Pylance supports your use case.

@InSyncWithFoo InSyncWithFoo reopened this Aug 27, 2024
@fkrauthan
Copy link
Author

Ah ok that make sense. Didn't know that the underlying LSP system does not yet support it.

And yeah I just tested your test build and it does not work. Even though ti seem to run the server in the context of my sub folder it still somehow detects the pyproject.toml of the root folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants
@fkrauthan @InSyncWithFoo and others