Skip to content

Commit

Permalink
fix: force virtual scripts version change on vue-tsc
Browse files Browse the repository at this point in the history
close #1082
  • Loading branch information
johnsoncodehk committed Mar 20, 2022
1 parent 67d3bdf commit c65872f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/vue-tsc/src/proxy.ts
Expand Up @@ -43,7 +43,7 @@ export function createProgramProxy(
getCssVBindRanges: () => [],
vueCompilerOptions,
vueLsHost: vueLsHost,
isTsPlugin: false,
isVueTsc: true,
});
const tsProgram = tsRuntime.getTsLs('script').getProgram();
if (!tsProgram) throw '!tsProgram';
Expand Down
7 changes: 6 additions & 1 deletion packages/vue-typescript/src/typescriptRuntime.ts
Expand Up @@ -26,6 +26,7 @@ export function createTypeScriptRuntime(options: {
getCssClasses: (cssEmbeddeFile: EmbeddedFile) => Record<string, TextRange[]>,
vueLsHost: LanguageServiceHost,
isTsPlugin?: boolean,
isVueTsc?: boolean,
}) {

const { typescript: ts } = options;
Expand Down Expand Up @@ -247,7 +248,11 @@ export function createTypeScriptRuntime(options: {
return fileVersions.get(maped.embedded.file)!;
}
else {
const version = ts.sys.createHash?.(maped.embedded.file.content) ?? maped.embedded.file.content;
let version = ts.sys.createHash?.(maped.embedded.file.content) ?? maped.embedded.file.content;
if (options.isVueTsc) {
// fix https://github.com/johnsoncodehk/volar/issues/1082
version = maped.vueFile.getVersion() + ':' + version;
}
fileVersions.set(maped.embedded.file, version);
return version;
}
Expand Down

0 comments on commit c65872f

Please sign in to comment.