Skip to content

Commit

Permalink
fix: typescript plugin not working
Browse files Browse the repository at this point in the history
close #1173
  • Loading branch information
johnsoncodehk committed Apr 12, 2022
1 parent 5d05dd6 commit 9db4518
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
31 changes: 18 additions & 13 deletions .vscode/launch.json
Expand Up @@ -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": [
Expand Down Expand Up @@ -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"
]
}
]
}
6 changes: 2 additions & 4 deletions packages/typescript-vue-plugin/src/index.ts
Expand Up @@ -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;
}

Expand All @@ -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,
Expand Down

0 comments on commit 9db4518

Please sign in to comment.