From 25fa7e06027d30637fb2325ebb6dbe27573e3ebd Mon Sep 17 00:00:00 2001 From: SerKo Date: Thu, 18 Dec 2025 02:27:43 +0800 Subject: [PATCH 1/2] fix: ignore non-vitepress markdown snapshots --- packages/typescript-plugin/index.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/typescript-plugin/index.ts b/packages/typescript-plugin/index.ts index f7a85f907f..d7b280aa91 100644 --- a/packages/typescript-plugin/index.ts +++ b/packages/typescript-plugin/index.ts @@ -35,6 +35,18 @@ export = createLanguageServicePlugin( vueOptions, id => id, ); + + const host = info.languageServiceHost; + const getScriptSnapshot = host.getScriptSnapshot?.bind(host); + if (getScriptSnapshot) { + host.getScriptSnapshot = fileName => { + if (!vueOptions.vitePressExtensions.some(ext => fileName.toLowerCase().endsWith(ext.toLowerCase()))) { + return; + } + return getScriptSnapshot(fileName); + }; + } + addVueCommands(); let _language: core.Language | undefined; From 0c8683214e01ca6011d33b196ea71e94a700c7d4 Mon Sep 17 00:00:00 2001 From: SerKo Date: Thu, 18 Dec 2025 02:42:28 +0800 Subject: [PATCH 2/2] fix --- packages/typescript-plugin/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/typescript-plugin/index.ts b/packages/typescript-plugin/index.ts index d7b280aa91..58564652a9 100644 --- a/packages/typescript-plugin/index.ts +++ b/packages/typescript-plugin/index.ts @@ -40,7 +40,9 @@ export = createLanguageServicePlugin( const getScriptSnapshot = host.getScriptSnapshot?.bind(host); if (getScriptSnapshot) { host.getScriptSnapshot = fileName => { - if (!vueOptions.vitePressExtensions.some(ext => fileName.toLowerCase().endsWith(ext.toLowerCase()))) { + const shouldIgnoreMarkdown = fileName.toLowerCase().endsWith('.md') + && !vueOptions.vitePressExtensions.some(ext => fileName.toLowerCase().endsWith(ext.toLowerCase())); + if (shouldIgnoreMarkdown) { return; } return getScriptSnapshot(fileName);