feat: redesign additional extensions, VitePress, PetiteVue support #4321
+264
−303
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
close #4251, close #3472
Motivation
In the past, the behavior of configuring additional extensions, VitePress and PetiteVue was inconsistent between IDEs and
vue-tsc
is inconsistent.For example, when
"vue.server.additionalExtensions": ["nvue"]
is configured, butvueCompilerOptions
is set to default:.nvue
files become project files for the Vue language server..nvue
files do not become project files forvue-tsc
..nvue
files.When
vueCompilerOptions: { "extensions": [".vue", ".nvue"] }
is configured, butvue.server.additionalExtensions
is set to default:.nvue
files become project files for the Vue language server..nvue
files become project files forvue-tsc
..nvue
files.This PR is to address this inconsistency.
vue.server.additionalExtensions
is actually not needed, and we can achieve the above 3 points by only configuringvueCompilerOptions: { "extensions": [".vue", ".nvue"] }
.Changes
vue.server.additionalExtensions
vue.server.petiteVue.supportHtmlFile
vue.server.vitePress.supportMdFile
vue.server.includeLanguages
vueCompilerOptions
:vitePressExtensions
petiteVueExtensions
Usage
Custom Vue Extensions Support
Using
.nvue
extension in uni-app as an example..nvue
to the tsconfig/jsconfiginclude
andvueCompilerOptions.extensions
options:.nvue
to the VSCodefiles.associations
setting:// .vscode/settings.json { "files.associations": { + "*.nvue": "vue" }, }
VitePress Support
.md
to the tsconfig/jsconfiginclude
andvueCompilerOptions.vitePressExtensions
options:markdown
to the VSCodevue.server.includeLanguages
setting:// .vscode/settings.json { "vue.server.includeLanguages": [ "vue", + "markdown", ], }
PetiteVue Support
.html
to the tsconfig/jsconfiginclude
andvueCompilerOptions.petiteVueExtensions
options:html
to the VSCodevue.server.includeLanguages
setting:// .vscode/settings.json { "vue.server.includeLanguages": [ "vue", + "html", ], }
Notes
Vue language server is currently unable to watch additional extensions, we need to wait for the next release of(Fixed by 31c9148)@volar/language-server
to expose the API for dynamically registering file watchers.