-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Describe the bug
Markdown files in VitePress projects don't have IntelliSense support for Vue features by default when using the official Vue Volar plugin in VS Code.
Reproduction
- Create a new
vitepressproject using the setup wizard
npx vitepress init -
Install the last version of the official
vs code - vue plugin
https://marketplace.visualstudio.com/items?itemName=Vue.volar -
Use any
Vuefeatures inside a markdown file
https://vitepress.dev/guide/using-vue#using-vue-in-markdown
index.md
---
hello: world
---
<script setup>
import { ref } from 'vue'
const count = ref(0)
</script>
## Markdown Content
The count is: {{ count }}
<button :class="$style.button" @click="count++">Increment</button>
<style module>
.button {
color: red;
font-weight: bold;
}
</style>Expected behavior
We can expect Vitepress and Volar to work seamlessly and provide IntelliSense feature out of the box on .md files, but according to this vue language tool merged PR, to achieve this, we have to follow a few steps.
VitePress Support
- Add
.mdto thetsconfiginclude option:
// tsconfig.json
{
"include": [
"src/**/*.ts",
"src/**/*.vue",
"src/**/*.md",
],
}- Add
.mdto thetsconfigvueCompilerOptions.vitePressExtensionsoption:
// tsconfig.json
{
"include": [
"src/**/*.ts",
"src/**/*.vue",
"src/**/*.md",
],
"vueCompilerOptions": {
"vitePressExtensions": [".md"],
},
}- For VSCode support, add
markdownto the VSCodevue.server.includeLanguagessetting:
// .vscode/settings.json
{
"vue.server.includeLanguages": ["vue", "markdown"]
}These steps aren't mentioned on the vitepress documentation, I'd like to add those steps to the documentation but wanna be sure first if this has been taken into consideration
System Info
System:
OS: Windows 11 10.0.22631
CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
Memory: 16.88 GB / 31.91 GB
Binaries:
Node: 20.17.0 - ~\AppData\Local\fnm_multishells\5536_1729010351260\node.EXE
npm: 10.8.2 - ~\AppData\Local\fnm_multishells\5536_1729010351260\npm.CMD
Browsers:
Edge: Chromium (127.0.2651.86)
Internet Explorer: 11.0.22621.3527
npmPackages:
vitepress: ^1.4.1 => 1.4.1
VsCode Plugins
vue.volar v2.1.6
Additional context
There is an open discussion at vuejs/eslint-plugin-vue repository to Add support for recognizing Vue components in .md files with the idea of improving the developer experience using Vitepress
Validations
- Check if you're on the latest VitePress version.
- Follow our Code of Conduct
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.