sublimelsp / LSP-pyright

Python support for Sublime's LSP plugin provided through microsoft/pyright.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Settings python.analysis.extraPaths Conflict with pyrightconfig extraPaths

munkybutt opened this issue · comments

Hey - I am trying to add paths to my .sublime-project file using "python.analysis.extraPaths".
This is used to add project specific paths on top of the paths in my pyrightconfig.json file.
The pyrightconfig.json is used to define shared settings for a number of projects that have the same set of dependencies as well as sharing pyright settings with vscode projects.
It seems that project settings are ignored if the pyrightconfig.json file already has "extraPaths" defined:

"settings":
{
    "LSP": {
        "LSP-pyright": {
            "settings": {
                "python.analysis.extraPaths": [
                    // paths here
                ]
            }
        }
    }
}

This is the same behaviour if I define "python.analysis.extraPaths" in the LSP-pyright global settings, pyrightconfig.json takes precedence.

If this is intentional is it possible to update the behaviour to be additive rather than exclusive?

I am not convinced that this is an issue of LSP-pyright. LSP-* merges project settings with plugin settings and send it to the server. That's all. This should be in https://github.com/microsoft/pyright/issues.

In https://github.com/microsoft/pyright/blob/main/docs/configuration.md, it only mentions A “pyrightconfig.json” file always takes precedent over “pyproject.toml” if both are present..

and there are 4 potential configuration sources:

  • pyrightconfig.json
  • pyproject.toml
  • workspace configuration (LSP spec)
  • command line arguments

It's only obvious that “pyrightconfig.json” overrides “pyproject.toml”.

If I replicate this setup in VSCode ( pyrightConfig.json with "extraPaths" defined and then define "python.analysis.extraPaths" in the .workspace file ) the behaviour is that the two lists are merged - which is the behaviour I was expecting with Sublime 😢

I don't see extraPaths in pyrightconfig.json is sent to Pylance in VSCode, which means it's likely handled by the server itself, which makes sense. That says, I can't reproduce your claim.


Update:

Pretty sure lists are not merged. pyrightconfig.json is prioritized and overrides workspace config.

xx_x264.mp4

Closed as I think this issue belongs to pyright (though I don't think they will change this behavior).