Skip to content

Commit

Permalink
Fixed bug that results in the extraPaths configuration option withi…
Browse files Browse the repository at this point in the history
…n an execution extending rather than overriding the `extraPaths` provided in the top-level config. This addresses #9636. (#9639)
  • Loading branch information
erictraut authored Dec 28, 2024
1 parent db368a1 commit 8f35aa0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 4 additions & 0 deletions packages/pyright-internal/src/common/configOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,10 @@ export class ConfigOptions {
`Config executionEnvironments index ${index}: extraPaths field must contain an array.`
);
} else {
// If specified, this overrides the default extra paths inherited
// from the top-level config.
newExecEnv.extraPaths = [];

const pathList = envObj.extraPaths as string[];
pathList.forEach((path, pathIndex) => {
if (typeof path !== 'string') {
Expand Down
5 changes: 0 additions & 5 deletions packages/pyright-internal/src/tests/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,6 @@ test('Command line options can override config but only when not using extension
commandLineOptions.configSettings.useLibraryCodeForTypes = true;
commandLineOptions.configSettings.includeFileSpecs = ['test2'];
commandLineOptions.configSettings.excludeFileSpecs = ['test2'];
commandLineOptions.configSettings.extraPaths = ['test2'];
commandLineOptions.configSettings.diagnosticSeverityOverrides = {
reportMissingImports: DiagnosticSeverityOverrides.Error,
};
Expand All @@ -485,10 +484,6 @@ test('Command line options can override config but only when not using extension
assert.notDeepStrictEqual(defaultOptions.exclude, overriddenOptions.exclude);
assert.notDeepStrictEqual(defaultOptions.ignore, overriddenOptions.ignore);
assert.notDeepStrictEqual(defaultOptions.diagnosticRuleSet, overriddenOptions.diagnosticRuleSet);
assert.notDeepStrictEqual(
defaultOptions.executionEnvironments[0].extraPaths,
overriddenOptions.executionEnvironments[0].extraPaths
);
assert.notDeepStrictEqual(defaultOptions.venvPath, overriddenOptions.venvPath);
// Typeshed and stub path are an exception, it should just be reported as a dupe.
assert.deepStrictEqual(defaultOptions.typeshedPath, overriddenOptions.typeshedPath);
Expand Down

0 comments on commit 8f35aa0

Please sign in to comment.