Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into avoid-errors-in-resol…
Browse files Browse the repository at this point in the history
…ver-statsync-calls
  • Loading branch information
cspotcode committed May 20, 2022
2 parents 57c7d17 + 5521f80 commit 75f0a06
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ contact_links:
-
name: "Help! My Types Are Missing!"
about: "This is likely a configuration problem. Check our README"
url: "https://typestrong.org/ts-node/docs/types"
url: "https://typestrong.org/ts-node/docs/troubleshooting#missing-types"
-
name: "TSError or SyntaxError"
about: "These errors come from TypeScript and node, respectively. Use StackOverflow or Discord for usage and configuration help."
about: "These errors come from TypeScript and node, respectively. Use Discussions or Discord for usage and configuration help."
url: "https://typestrong.org/ts-node/docs/troubleshooting"
13 changes: 9 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1071,9 +1071,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 : []);

Expand Down Expand Up @@ -1257,9 +1261,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 75f0a06

Please sign in to comment.