mirror of
https://github.com/microsoft/pyright.git
synced 2024-08-15 10:50:44 +03:00
Switched "pyright.typeCheckingMode" to "python.analysis.typeCheckingMode" for compatibility with Pylance.
This commit is contained in:
parent
a97a5878d3
commit
f6200f9887
@ -118,6 +118,17 @@
|
||||
"trace"
|
||||
]
|
||||
},
|
||||
"python.analysis.typeCheckingMode": {
|
||||
"type": "string",
|
||||
"default": "basic",
|
||||
"enum": [
|
||||
"off",
|
||||
"basic",
|
||||
"strict"
|
||||
],
|
||||
"description": "Defines the default rule set for type checking.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"python.analysis.typeshedPaths": {
|
||||
"type": "array",
|
||||
"default": [],
|
||||
@ -145,17 +156,6 @@
|
||||
"description": "Path to Python, you can use a custom version of Python.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"pyright.typeCheckingMode": {
|
||||
"type": "string",
|
||||
"default": "basic",
|
||||
"enum": [
|
||||
"off",
|
||||
"basic",
|
||||
"strict"
|
||||
],
|
||||
"description": "Defines the default rule set for type checking.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"pyright.useLibraryCodeForTypes": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
|
@ -8,8 +8,6 @@ The Pyright VS Code extension honors the following settings.
|
||||
|
||||
**pyright.openFilesOnly** [boolean]: Determines whether pyright analyzes (and reports errors for) all files in the workspace, as indicated by the config file. If this option is set to true, pyright analyzes only open files. This setting is deprecated in favor of python.analysis.diagnosticMode. It will be removed at a future time.
|
||||
|
||||
**pyright.typeCheckingMode** ["off", "basic", "strict"]: Determines the default type-checking level used by pyright. This can be overridden in the configuration file.
|
||||
|
||||
**pyright.useLibraryCodeForTypes** [boolean]: Determines whether pyright reads, parses and analyzes library code to extract type information in the absence of type stub files. This can add significant overhead and may result in poor-quality type information. The default value for this option is false.
|
||||
|
||||
**python.analysis.typeshedPaths** [array of paths]: Paths to look for typeshed modules. Pyright currently honors only the first path in the array.
|
||||
@ -22,6 +20,8 @@ The Pyright VS Code extension honors the following settings.
|
||||
|
||||
**python.analysis.stubPath** [path]: Path to directory containing custom type stub files.
|
||||
|
||||
**python.analysis.typeCheckingMode** ["off", "basic", "strict"]: Determines the default type-checking level used by pyright. This can be overridden in the configuration file. (Note: This setting used to be called "pyright.typeCheckingMode". The old name is deprecated but is still currently honored.)
|
||||
|
||||
**python.analysis.diagnosticMode** ["openFilesOnly", "workspace"]: Determines whether pyright analyzes (and reports errors for) all files in the workspace, as indicated by the config file. If this option is set to "openFilesOnly", pyright analyzes only open files.
|
||||
|
||||
**python.analysis.diagnosticSeverityOverrides** [map]: Allows a user to override the severity levels for individual diagnostic rules. "reportXXX" rules in the type check diagnostics settings in [configuration](https://github.com/microsoft/pyright/blob/master/docs/configuration.md#type-check-diagnostics-settings) are supported. Use the rule name as a key and one of "error," "warning," "information," "true," "false," or "none" as value.
|
||||
|
@ -49,6 +49,11 @@ class PyrightServer extends LanguageServerBase {
|
||||
async getSettings(workspace: WorkspaceServiceInstance): Promise<ServerSettings> {
|
||||
const serverSettings: ServerSettings = {
|
||||
watchForSourceChanges: true,
|
||||
openFilesOnly: true,
|
||||
useLibraryCodeForTypes: false,
|
||||
disableLanguageServices: false,
|
||||
disableOrganizeImports: false,
|
||||
typeCheckingMode: 'basic',
|
||||
diagnosticSeverityOverrides: {},
|
||||
logLevel: LogLevel.Info,
|
||||
};
|
||||
@ -96,6 +101,10 @@ class PyrightServer extends LanguageServerBase {
|
||||
if (extraPaths && isArray(extraPaths) && extraPaths.length > 0) {
|
||||
serverSettings.extraPaths = extraPaths.map((p) => normalizeSlashes(p));
|
||||
}
|
||||
|
||||
if (pythonAnalysisSection.typeCheckingMode !== undefined) {
|
||||
serverSettings.typeCheckingMode = pythonAnalysisSection.typeCheckingMode;
|
||||
}
|
||||
} else {
|
||||
serverSettings.autoSearchPaths = true;
|
||||
}
|
||||
@ -109,14 +118,9 @@ class PyrightServer extends LanguageServerBase {
|
||||
serverSettings.useLibraryCodeForTypes = !!pyrightSection.useLibraryCodeForTypes;
|
||||
serverSettings.disableLanguageServices = !!pyrightSection.disableLanguageServices;
|
||||
serverSettings.disableOrganizeImports = !!pyrightSection.disableOrganizeImports;
|
||||
serverSettings.typeCheckingMode = pyrightSection.typeCheckingMode;
|
||||
} else {
|
||||
// Unless openFilesOnly is set explicitly, set it to true by default.
|
||||
serverSettings.openFilesOnly = serverSettings.openFilesOnly ?? true;
|
||||
serverSettings.useLibraryCodeForTypes = false;
|
||||
serverSettings.disableLanguageServices = false;
|
||||
serverSettings.disableOrganizeImports = false;
|
||||
serverSettings.typeCheckingMode = undefined;
|
||||
if (pyrightSection.typeCheckingMode !== undefined) {
|
||||
serverSettings.typeCheckingMode = pyrightSection.typeCheckingMode;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this.console.error(`Error reading settings: ${error}`);
|
||||
|
Loading…
Reference in New Issue
Block a user