Skip to content

Commit eae45d0

Browse files
committed
fix(language-core): template language of .md files should be markdown
close #4299
1 parent 0f80d2d commit eae45d0

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

packages/language-core/lib/plugins/file-md.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const plugin: VueLanguagePlugin = () => {
5454
const sfc = parse(toString(codes));
5555

5656
if (sfc.descriptor.template) {
57+
sfc.descriptor.template.lang = 'md';
5758
transformRange(sfc.descriptor.template);
5859
}
5960
if (sfc.descriptor.script) {

packages/language-core/lib/plugins/vue-template-html.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const plugin: VueLanguagePlugin = ({ modules }) => {
1616

1717
compileSFCTemplate(lang, template, options) {
1818

19-
if (lang === 'html') {
19+
if (lang === 'html' || lang === 'md') {
2020

2121
const compiler = modules['@vue/compiler-dom'];
2222

packages/language-service/lib/plugins/vue-template.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,26 @@ export function create(
3535
},
3636
};
3737
};
38-
const baseServicePlugin = mode === 'pug' ? createPugService : createHtmlService;
39-
const baseService = baseServicePlugin({
40-
getCustomData() {
41-
return [
42-
...customData,
43-
...extraCustomData,
44-
];
45-
},
46-
onDidChangeCustomData,
47-
});
38+
const baseService = mode === 'pug'
39+
? createPugService({
40+
getCustomData() {
41+
return [
42+
...customData,
43+
...extraCustomData,
44+
];
45+
},
46+
onDidChangeCustomData,
47+
})
48+
: createHtmlService({
49+
documentSelector: ['html', 'markdown'],
50+
getCustomData() {
51+
return [
52+
...customData,
53+
...extraCustomData,
54+
];
55+
},
56+
onDidChangeCustomData,
57+
});
4858

4959
return {
5060
name: `vue-template (${mode})`,

0 commit comments

Comments
 (0)