From 97dcf7082ba008457d08d9b0f87c2374115705f4 Mon Sep 17 00:00:00 2001 From: detachhead Date: Sat, 7 Dec 2024 19:18:24 +1000 Subject: [PATCH] fix typeshed files sometimes being treated as source files --- packages/pyright-internal/src/analyzer/program.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/pyright-internal/src/analyzer/program.ts b/packages/pyright-internal/src/analyzer/program.ts index 05c82522e1..b25ff3c225 100644 --- a/packages/pyright-internal/src/analyzer/program.ts +++ b/packages/pyright-internal/src/analyzer/program.ts @@ -327,7 +327,12 @@ export class Program { return fileInfo; } - addTrackedFile(fileUri: Uri, isThirdPartyImport = false, isInPyTypedPackage = false): SourceFile { + addTrackedFile( + fileUri: Uri, + isThirdPartyImport = false, + isInPyTypedPackage = false, + isTypeshedFile = false + ): SourceFile { let sourceFileInfo = this.getSourceFileInfo(fileUri); const moduleImportInfo = this._getModuleImportInfoForFile(fileUri); const importName = moduleImportInfo.moduleName; @@ -352,7 +357,7 @@ export class Program { ); sourceFileInfo = new SourceFileInfo( sourceFile, - /* isTypeshedFile */ false, + isTypeshedFile, isThirdPartyImport, isInPyTypedPackage, this._editModeTracker, @@ -1833,7 +1838,7 @@ export class Program { if (!sourceFileInfo) { // Start tracking the source file. - this.addTrackedFile(resolvedPath); + this.addTrackedFile(resolvedPath, false, false, importResult.isStdlibTypeshedFile); sourceFileInfo = this.getSourceFileInfo(resolvedPath); } }