Skip to content

Commit e9da626

Browse files
committed
refactor(typescript-plugin): simplify languageServiceHost initialization
1 parent aa0d842 commit e9da626

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/typescript-plugin/lib/requests/getReactiveReferences.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ let currentVersion = -1;
1212
let currentFileName = '';
1313
let currentSnapshot: ts.IScriptSnapshot | undefined;
1414
let languageService: ts.LanguageService | undefined;
15-
let languageServiceHost: ts.LanguageServiceHost | undefined;
1615

1716
export function getReactiveReferences(
1817
ts: typeof import('typescript'),
@@ -27,12 +26,13 @@ export function getReactiveReferences(
2726
currentVersion++;
2827
}
2928
if (!languageService) {
30-
languageServiceHost = {
29+
const compilerOptions: ts.CompilerOptions = { allowJs: true, allowNonTsExtensions: true };
30+
const languageServiceHost: ts.LanguageServiceHost = {
3131
getProjectVersion: () => currentVersion.toString(),
3232
getScriptVersion: () => currentVersion.toString(),
3333
getScriptFileNames: () => [currentFileName],
3434
getScriptSnapshot: fileName => fileName === currentFileName ? currentSnapshot : undefined,
35-
getCompilationSettings: () => ({ allowJs: true, allowNonTsExtensions: true }),
35+
getCompilationSettings: () => compilerOptions,
3636
getCurrentDirectory: () => '',
3737
getDefaultLibFileName: () => '',
3838
readFile: () => undefined,

0 commit comments

Comments
 (0)