From b3bc9b29ffb585535118ab8eb48708cc7c1aa6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=B1=E5=90=B9=E8=89=B2=E5=BE=A1=E5=AE=88?= <85992002+KazariEX@users.noreply.github.com> Date: Mon, 14 Jul 2025 19:47:58 +0800 Subject: [PATCH 1/2] fix: do not set template lang to `md` for markdown --- packages/language-core/lib/plugins/file-md.ts | 62 +++++++++---------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/packages/language-core/lib/plugins/file-md.ts b/packages/language-core/lib/plugins/file-md.ts index 2f332d73d9..8268b2ec04 100644 --- a/packages/language-core/lib/plugins/file-md.ts +++ b/packages/language-core/lib/plugins/file-md.ts @@ -1,4 +1,4 @@ -import { type CodeInformation, defaultMapperFactory, type Mapping } from '@volar/language-core'; +import { SourceMap } from '@volar/language-core'; import type { SFCBlock } from '@vue/compiler-sfc'; import { type Segment, toString } from 'muggle-string'; import type { VueLanguagePlugin } from '../types'; @@ -10,9 +10,9 @@ const codeblockReg = /(`{3,})[\s\S]+?\1/g; const inlineCodeblockReg = /`[^\n`]+?`/g; const latexBlockReg = /(\${2,})[\s\S]+?\1/g; const scriptSetupReg = /\\<[\s\S]+?>\n?/g; -const sfcBlockReg = /<(script|style)\b[\s\S]*?>([\s\S]*?)<\/\1>/g; const angleBracketReg = /<\S*:\S*>/g; const linkReg = /\[[\s\S]*?\]\([\s\S]*?\)/g; +const sfcBlockReg = /<(script|style)\b[\s\S]*?>([\s\S]*?)<\/\1>/g; const codeSnippetImportReg = /^\s*<<<\s*.+/gm; const plugin: VueLanguagePlugin = ({ vueCompilerOptions }) => { @@ -46,48 +46,42 @@ const plugin: VueLanguagePlugin = ({ vueCompilerOptions }) => { // # \