diff --git a/packages/typescript-plugin/index.ts b/packages/typescript-plugin/index.ts index f7a85f907f..58564652a9 100644 --- a/packages/typescript-plugin/index.ts +++ b/packages/typescript-plugin/index.ts @@ -35,6 +35,20 @@ export = createLanguageServicePlugin( vueOptions, id => id, ); + + const host = info.languageServiceHost; + const getScriptSnapshot = host.getScriptSnapshot?.bind(host); + if (getScriptSnapshot) { + host.getScriptSnapshot = fileName => { + const shouldIgnoreMarkdown = fileName.toLowerCase().endsWith('.md') + && !vueOptions.vitePressExtensions.some(ext => fileName.toLowerCase().endsWith(ext.toLowerCase())); + if (shouldIgnoreMarkdown) { + return; + } + return getScriptSnapshot(fileName); + }; + } + addVueCommands(); let _language: core.Language | undefined;