diff --git a/.vscode/launch.json b/.vscode/launch.json index 951b73fa3..646e40d74 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -3,13 +3,29 @@ "version": "0.2.0", "configurations": [ { - "name": "Launch Client", + "name": "Launch Vue Language Features", "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", "args": [ "--disable-extensions", - "--extensionDevelopmentPath=${workspaceRoot}/extensions/vscode-vue-language-features", + "--extensionDevelopmentPath=${workspaceRoot}/extensions/vscode-vue-language-features" + ], + "outFiles": [ + "${workspaceRoot}/extensions/*/out/**/*.js", + "${workspaceRoot}/packages/*/out/**/*.js" + ], + "preLaunchTask": { + "type": "npm", + "script": "watch" + } + }, + { + "type": "extensionHost", + "request": "launch", + "name": "Launch TypeScript Vue Plugin", + "runtimeExecutable": "${execPath}", + "args": [ "--extensionDevelopmentPath=${workspaceRoot}/extensions/vscode-typescript-vue-plugin" ], "outFiles": [ @@ -71,15 +87,4 @@ ] } ], - "compounds": [ - { - "name": "Client + Server", - "configurations": [ - "Launch Client", - "Attach to Langauge Features Server", - "Attach to Second Language Features Server", - "Attach to Document Features Server" - ] - } - ] } \ No newline at end of file diff --git a/packages/typescript-vue-plugin/src/index.ts b/packages/typescript-vue-plugin/src/index.ts index 38e9fae98..76e0223b2 100644 --- a/packages/typescript-vue-plugin/src/index.ts +++ b/packages/typescript-vue-plugin/src/index.ts @@ -9,10 +9,9 @@ const init: ts.server.PluginModuleFactory = (modules) => { const pluginModule: ts.server.PluginModule = { create(info) { - const files = info.project.getScriptFileNames(); - const hasVueFile = files.some(file => file.endsWith('.vue')); + const proxyHost = createProxyHost(ts, info); - if (!hasVueFile) { + if (proxyHost.getVueFiles().length === 0) { return info.languageService; } @@ -29,7 +28,6 @@ const init: ts.server.PluginModuleFactory = (modules) => { } }; - const proxyHost = createProxyHost(ts, info); const vueCompilerOptions = proxyHost.host.getVueCompilationSettings?.() ?? {}; const tsRuntime = vue.createTypeScriptRuntime({ typescript: ts,