Skip to content

Commit fa7f5cb

Browse files
committed
Actually verify when dependency and main project is open
1 parent 6cb3065 commit fa7f5cb

File tree

4 files changed

+192
-123
lines changed

4 files changed

+192
-123
lines changed

src/compiler/sourcemap.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,8 @@ namespace ts {
583583
}
584584

585585
function compareSourcePositions(left: SourceMappedPosition, right: SourceMappedPosition) {
586-
return compareValues(left.sourceIndex, right.sourceIndex);
586+
Debug.assert(left.sourceIndex === right.sourceIndex);
587+
return compareValues(left.sourcePosition, right.sourcePosition);
587588
}
588589

589590
function compareGeneratedPositions(left: MappedPosition, right: MappedPosition) {

src/server/editorServices.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2604,7 +2604,7 @@ namespace ts.server {
26042604

26052605
/** @internal */
26062606
fileExists(fileName: NormalizedPath): boolean {
2607-
return this.filenameToScriptInfo.has(fileName) || this.host.fileExists(fileName);
2607+
return !!this.getScriptInfoForNormalizedPath(fileName) || this.host.fileExists(fileName);
26082608
}
26092609

26102610
private findExternalProjectContainingOpenScriptInfo(info: ScriptInfo): ExternalProject | undefined {

src/server/project.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,10 @@ namespace ts.server {
759759
}
760760

761761
containsScriptInfo(info: ScriptInfo): boolean {
762-
return this.isRoot(info) || (!!this.program && this.program.getSourceFileByPath(info.path) !== undefined);
762+
if (this.isRoot(info)) return true;
763+
if (!this.program) return false;
764+
const file = this.program.getSourceFileByPath(info.path);
765+
return !!file && file.resolvedPath === info.path;
763766
}
764767

765768
containsFile(filename: NormalizedPath, requireOpen?: boolean): boolean {

0 commit comments

Comments
 (0)