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

Non-workspace locations for pyrightconfig.json #1756

Closed
zbs opened this issue Apr 12, 2021 · 5 comments
Closed

Non-workspace locations for pyrightconfig.json #1756

zbs opened this issue Apr 12, 2021 · 5 comments
Labels
as designed Not a bug, working as intended

Comments

@zbs
Copy link

zbs commented Apr 12, 2021

I have several VS Code workspaces for copies of the same git repo:

- ~/zbs
    - dev
        - my_repo_v1                                                  <-- VS Code workspace #1
            - pyrightconfig.json
        - my_repo_v2                                                  <-- VS Code workspace #2
            - pyrightconfig.json

I would like to use the same pyrightconfig.json for each of them without needing to add it to the git repository. Is there any way I can add it above my workspace roots and somehow configure the language server to point to it?

Language Server version: 2021.3.2
VS Code: 1.54.3
OS and version: Windows 10 Enterprise 20H2, using Remote SSH onto an RHEL 7 Host
Python version (& distribution if applicable, e.g. Anaconda): Python 2.7 on Miniconda 3
@erictraut
Copy link
Collaborator

erictraut commented Apr 12, 2021

No, there's currently no way to do that. Each workspace root requires its own pyrightconfig.json file.

Paths inside of pyrightconfig.json are assumed to be workspace-relative, so sharing a pyrightconfig.json would be problematic.

Out of curiosity, if you're using VS Code, why are you not using Pylance? And is there a reason you are not using VS Code settings rather than a pyrightconfig.json file? I realize that there are configuration knobs provided in pyrightconfig.json that have no analog in VS Code settings, but these are more esoteric features.

@erictraut erictraut added the as designed Not a bug, working as intended label Apr 12, 2021
@zbs
Copy link
Author

zbs commented Apr 12, 2021

No, there's currently no way to do that. Each workspace root requires its own pyrightconfig.json file.

Paths inside of pyrightconfig.json are assumed to be workspace-relative, so sharing a pyrightconfig.json would be problematic.

VS Code allows for non-workspace-relative paths in its settings. For example, you could have a setting that excludes ${workspaceRoot}/**/problematic_subdirectory. I'm curious if something like that is more doable, maybe within the framework of VS Code settings.

Out of curiosity, if you're using VS Code, why are you not using Pylance? And is there a reason you are not using VS Code settings rather than a pyrightconfig.json file? I realize that there are configuration knobs provided in pyrightconfig.json that have no analog in VS Code settings, but these are more esoteric features.

I am using VS Code + Pylance. Per this issue, the VS Code settings are insufficient to stop Pylance from attempting to index symlinks to very large subdirectories, which essentially breaks the Python language features.

At any rate, thank you for the quick reply!

@erictraut
Copy link
Collaborator

The "exclude" config option is something we should probably consider exposing within VS Code settings. I think there's already an open issue on that in the pylance-release issue tracker. Feel free to upvote that issue, or create a new one if you can't find it.

@jakebailey
Copy link
Member

I'm not sure we have a dedicated issue for that, but microsoft/pylance-release#123 is close. Would be nice to have an issue for "add python.analysis.exclude" and such

@zbs
Copy link
Author

zbs commented Apr 13, 2021

Done. Thanks for keeping this train rolling!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
as designed Not a bug, working as intended
Projects
None yet
Development

No branches or pull requests

3 participants