diff --git a/src/compiler/program.ts b/src/compiler/program.ts index f6e3b4e5399..82b8b209f85 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -883,9 +883,9 @@ namespace ts { // `packageIdToSourceFile` is only used while building the program, while `sourceFileToPackageName` and `isSourceFileTargetOfRedirect` are kept around. const packageIdToSourceFile = new Map(); // Maps from a SourceFile's `.path` to the name of the package it was imported with. - let sourceFileToPackageName = new Map(); + let sourceFileToPackageName = new Map(); // Key is a file name. Value is the (non-empty, or undefined) list of files that redirect to it. - let redirectTargetsMap = createMultiMap(); + let redirectTargetsMap = createMultiMap(); /** * map with diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 576ca26f985..1509db1d569 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3944,9 +3944,9 @@ namespace ts { /* @internal */ getLibFileFromReference(ref: FileReference): SourceFile | undefined; /** Given a source file, get the name of the package it was imported from. */ - /* @internal */ sourceFileToPackageName: ESMap; + /* @internal */ sourceFileToPackageName: ESMap; /** Set of all source files that some other source file redirects to. */ - /* @internal */ redirectTargetsMap: MultiMap; + /* @internal */ redirectTargetsMap: MultiMap; /** Is the file emitted file */ /* @internal */ isEmittedFile(file: string): boolean; /* @internal */ getFileIncludeReasons(): MultiMap; @@ -3974,7 +3974,7 @@ namespace ts { } /* @internal */ - export type RedirectTargetsMap = ReadonlyESMap; + export type RedirectTargetsMap = ReadonlyESMap; export interface ResolvedProjectReference { commandLine: ParsedCommandLine; diff --git a/src/services/documentHighlights.ts b/src/services/documentHighlights.ts index 3a48cbc91c6..ffcec349cc6 100644 --- a/src/services/documentHighlights.ts +++ b/src/services/documentHighlights.ts @@ -32,9 +32,10 @@ namespace ts { const referenceEntries = FindAllReferences.getReferenceEntriesForNode(position, node, program, sourceFilesToSearch, cancellationToken, /*options*/ undefined, sourceFilesSet); if (!referenceEntries) return undefined; const map = arrayToMultiMap(referenceEntries.map(FindAllReferences.toHighlightSpan), e => e.fileName, e => e.span); + const getCanonicalFileName = createGetCanonicalFileName(program.useCaseSensitiveFileNames()); return mapDefined(arrayFrom(map.entries()), ([fileName, highlightSpans]) => { if (!sourceFilesSet.has(fileName)) { - if (!program.redirectTargetsMap.has(fileName)) { + if (!program.redirectTargetsMap.has(toPath(fileName, program.getCurrentDirectory(), getCanonicalFileName))) { return undefined; } const redirectTarget = program.getSourceFile(fileName);