Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
cspotcode committed May 20, 2022
1 parent a449373 commit 3972e28
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1097,9 +1097,10 @@ 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 : []);

Expand Down Expand Up @@ -1283,9 +1284,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}`);

Expand Down

0 comments on commit 3972e28

Please sign in to comment.