From 7a32486bd98c9706e05d00807f890d51ebb04eb9 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Thu, 27 Jun 2024 00:40:08 +0800 Subject: [PATCH] fix(language-server): LSP mode crash --- packages/language-server/lib/initialize.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/language-server/lib/initialize.ts b/packages/language-server/lib/initialize.ts index dfb24bf321..f244895b72 100644 --- a/packages/language-server/lib/initialize.ts +++ b/packages/language-server/lib/initialize.ts @@ -19,6 +19,7 @@ export function initialize( ts, tsLocalized, async ({ configFileName, sys, projectHost, asFileName }) => { + let compilerOptions: ts.CompilerOptions; let vueCompilerOptions: VueCompilerOptions; if (configFileName) { let commandLine = createParsedCommandLine(ts, sys, configFileName); @@ -29,9 +30,11 @@ export function initialize( sysVersion = newSysVersion; newSysVersion = await sys.sync(); } + compilerOptions = commandLine.options; vueCompilerOptions = commandLine.vueOptions; } else { + compilerOptions = ts.getDefaultCompilerOptions(); vueCompilerOptions = resolveVueCompilerOptions({}); } updateFileWatcher(vueCompilerOptions); @@ -47,7 +50,7 @@ export function initialize( } return fileMap.has(fileName); }, - projectHost.getCompilationSettings(), + compilerOptions, vueCompilerOptions )], setup(language) {