Skip to content

Commit

Permalink
fix: avoid ts plugin affect to non-vue project
Browse files Browse the repository at this point in the history
close #1144
  • Loading branch information
johnsoncodehk committed Apr 10, 2022
1 parent 6ee2a77 commit 23453db
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/typescript-vue-plugin/src/index.ts
Expand Up @@ -9,6 +9,13 @@ 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'));

if (!hasVueFile) {
return info.languageService;
}

// fix: https://github.com/johnsoncodehk/volar/issues/205
info.project.getScriptKind = fileName => {
switch (path.extname(fileName)) {
Expand Down

0 comments on commit 23453db

Please sign in to comment.