@@ -62,13 +62,13 @@ export function getServiceHost(
62
62
const vueSys = getVueSys ( tsModule ) ;
63
63
64
64
let currentScriptDoc : TextDocument ;
65
+ let scriptFileNames : string [ ] = [ ] ;
65
66
const versions = new Map < string , number > ( ) ;
66
67
const scriptDocs = new Map < string , TextDocument > ( ) ;
67
68
68
69
const parsedConfig = getParsedConfig ( tsModule , workspacePath ) ;
69
70
const files = parsedConfig . fileNames ;
70
71
logger . logDebug ( `Initializing ServiceHost with ${ files . length } files: ${ JSON . stringify ( files ) } ` ) ;
71
- const scriptFileNameSet = new Set ( files ) ;
72
72
73
73
const isOldVersion = inferIsOldVersion ( tsModule , workspacePath ) ;
74
74
const compilerOptions = {
@@ -104,12 +104,12 @@ export function getServiceHost(
104
104
105
105
function updateCurrentTextDocument ( doc : TextDocument ) {
106
106
const fileFsPath = getFileFsPath ( doc . uri ) ;
107
- const filePath = getFilePath ( doc . uri ) ;
108
- // When file is not in language service, add it
109
- if ( ! scriptDocs . has ( fileFsPath ) ) {
110
- if ( fileFsPath . endsWith ( '.vue' ) || fileFsPath . endsWith ( '.vue.template' ) ) {
111
- scriptFileNameSet . add ( filePath ) ;
112
- }
107
+
108
+ if ( fileFsPath . endsWith ( '.vue' ) ) {
109
+ scriptFileNames = [ fileFsPath , fileFsPath + '.template' ] ;
110
+ }
111
+ if ( fileFsPath . endsWith ( '.vue.template' ) ) {
112
+ scriptFileNames = [ fileFsPath . slice ( 0 , - '.template' . length ) , fileFsPath ] ;
113
113
}
114
114
115
115
if ( isVirtualVueTemplateFile ( fileFsPath ) ) {
@@ -143,7 +143,7 @@ export function getServiceHost(
143
143
function createLanguageServiceHost ( options : ts . CompilerOptions ) : ts . LanguageServiceHost {
144
144
return {
145
145
getCompilationSettings : ( ) => options ,
146
- getScriptFileNames : ( ) => Array . from ( scriptFileNameSet ) ,
146
+ getScriptFileNames : ( ) => scriptFileNames ,
147
147
getScriptVersion ( fileName ) {
148
148
if ( fileName === bridge . fileName ) {
149
149
return '0' ;
0 commit comments