Added support for "python.analysis.autoSearchPaths" setting. If enabled (as it is by default), it automatically adds "src" to the import search paths. It is common for workspaces to contain a directory by this name.

This commit is contained in:
Eric Traut 2020-04-25 14:26:46 -07:00
parent 175a068bbd
commit 921de3097e
3 changed files with 9 additions and 1 deletions

View File

@ -75,6 +75,12 @@
"description": "Paths to look for typeshed modules.",
"scope": "resource"
},
"python.analysis.autoSearchPaths": {
"type": "boolean",
"default": true,
"description": "Automatically add common search paths like 'src'?",
"scope": "resource"
},
"python.pythonPath": {
"type": "string",
"default": "python",

View File

@ -14,6 +14,8 @@ The Pyright VS Code extension honors the following settings.
**python.analysis.typeshedPaths** [array of paths]: Paths to look for typeshed modules. Pyright currently honors only the first path in the array.
**python.analysis.autoSearchPaths** [boolean]: Determines whether pyright automatically adds common search paths like "src" if there are no execution environments defined in the config file.
**python.pythonPath** [path]: Path to Python interpreter.
**python.venvPath** [path]: Path to folder with subdirectories that contain virtual environments.

View File

@ -45,7 +45,7 @@ class PyrightServer extends LanguageServerBase {
}
serverSettings.autoSearchPaths = !!pythonAnalysisSection.autoSearchPaths;
} else {
serverSettings.autoSearchPaths = false;
serverSettings.autoSearchPaths = true;
}
const pyrightSection = await this.getConfiguration(workspace, 'pyright');