diff --git a/src/index.ts b/src/index.ts index a0079bd24..976c1ca89 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1097,9 +1097,13 @@ export function createFromPreloadedConfig( }; getTypeInfo = (code: string, fileName: string, position: number) => { - updateMemoryCache(code, fileName); + const normalizedFileName = normalizeSlashes(fileName); + updateMemoryCache(code, normalizedFileName); - const info = service.getQuickInfoAtPosition(fileName, position); + const info = service.getQuickInfoAtPosition( + normalizedFileName, + position + ); const name = ts.displayPartsToString(info ? info.displayParts : []); const comment = ts.displayPartsToString(info ? info.documentation : []); @@ -1283,9 +1287,10 @@ export function createFromPreloadedConfig( }; getTypeInfo = (code: string, fileName: string, position: number) => { - updateMemoryCache(code, fileName); + const normalizedFileName = normalizeSlashes(fileName); + updateMemoryCache(code, normalizedFileName); - const sourceFile = builderProgram.getSourceFile(fileName); + const sourceFile = builderProgram.getSourceFile(normalizedFileName); if (!sourceFile) throw new TypeError(`Unable to read file: ${fileName}`);