Skip to content

Commit

Permalink
fix typeshed files sometimes being treated as source files
Browse files Browse the repository at this point in the history
  • Loading branch information
DetachHead committed Dec 7, 2024
1 parent fd05d52 commit 7e12080
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/pyright-internal/src/analyzer/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -352,7 +357,7 @@ export class Program {
);
sourceFileInfo = new SourceFileInfo(
sourceFile,
/* isTypeshedFile */ false,
isTypeshedFile,
isThirdPartyImport,
isInPyTypedPackage,
this._editModeTracker,
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 7e12080

Please sign in to comment.