From 88bff5a66ec4cf007c6f439617f353e92ef970bf Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Fri, 23 Aug 2024 02:49:09 +0800 Subject: [PATCH] fix test --- packages/language-core/lib/languagePlugin.ts | 4 +++- packages/language-core/lib/plugins/vue-tsx.ts | 4 ++-- packages/language-core/lib/types.ts | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/language-core/lib/languagePlugin.ts b/packages/language-core/lib/languagePlugin.ts index d6bb0ff457..66188ac483 100644 --- a/packages/language-core/lib/languagePlugin.ts +++ b/packages/language-core/lib/languagePlugin.ts @@ -92,7 +92,8 @@ export function createVueLanguagePlugin2( asFileName: (scriptId: T) => string, isRootFile: (fileName: string) => boolean, compilerOptions: ts.CompilerOptions, - vueCompilerOptions: VueCompilerOptions + vueCompilerOptions: VueCompilerOptions, + test?: boolean ): LanguagePlugin { const pluginContext: Parameters[0] = { modules: { @@ -107,6 +108,7 @@ export function createVueLanguagePlugin2( compilerOptions, vueCompilerOptions, globalTypesHolder: undefined, + test, }; const plugins = createPlugins(pluginContext); diff --git a/packages/language-core/lib/plugins/vue-tsx.ts b/packages/language-core/lib/plugins/vue-tsx.ts index 861e056269..031e764217 100644 --- a/packages/language-core/lib/plugins/vue-tsx.ts +++ b/packages/language-core/lib/plugins/vue-tsx.ts @@ -94,7 +94,7 @@ function createTsx( compilerOptions: ctx.compilerOptions, vueCompilerOptions: ctx.vueCompilerOptions, template: _sfc.template, - edited: (fileEditTimes.get(fileName) ?? 0) >= 2, + edited: ctx.test || (fileEditTimes.get(fileName) ?? 0) >= 2, scriptSetupBindingNames: scriptSetupBindingNames(), scriptSetupImportComponentNames: scriptSetupImportComponentNames(), hasDefineSlots: hasDefineSlots(), @@ -154,7 +154,7 @@ function createTsx( templateCodegen: _template, compilerOptions: ctx.compilerOptions, vueCompilerOptions: ctx.vueCompilerOptions, - edited: (fileEditTimes.get(fileName) ?? 0) >= 2, + edited: ctx.test || (fileEditTimes.get(fileName) ?? 0) >= 2, getGeneratedLength: () => generatedLength, linkedCodeMappings, }); diff --git a/packages/language-core/lib/types.ts b/packages/language-core/lib/types.ts index ac0e9faca8..d860bb2bfe 100644 --- a/packages/language-core/lib/types.ts +++ b/packages/language-core/lib/types.ts @@ -78,6 +78,7 @@ export type VueLanguagePlugin = (ctx: { compilerOptions: ts.CompilerOptions; vueCompilerOptions: VueCompilerOptions; globalTypesHolder: string | undefined; + test?: boolean; }) => VueLanguagePluginReturn | VueLanguagePluginReturn[]; export interface SfcBlock {