Vue's single-file components use a template language of their own. To make template editing feel closer to TSX, an editor needs autocomplete, diagnostics, and other language features inside <template>. Those features depend on editor plugins and language servers. Three projects have shaped this area: Vetur, VueDX, and Vue Language Tools. Their history also explains the core mechanism behind Vue template tooling.
Starting with HTML-only templates
Vetur's first releases did not offer JavaScript language support inside <template>; they only provided HTML completion. Katashin raised an issue asking for JavaScript completion there, then built a simple type checker himself. It did not reuse TypeScript's checker, so its capabilities were limited.
The idea that stuck
A developer named Hai proposed another route: transform <template> into equivalent TypeScript, let TypeScript's checker analyze that generated code, and use a SourceMap to translate completions and diagnostics back to the original template. The idea was adopted. It also became the basic working principle for later Vue language tools.
Vetur's implementation
Vetur parses SFCs with vue-eslint-parser, the same parser used by eslint-plugin-vue. It walks the AST nodes in <template> and generates equivalent TypeScript, referred to as Virtual Code. For this generation, Vetur uses TypeScript's own APIs. The generated code is what the TypeScript language service can understand; the mapping layer is what lets the editor show results at the right place in the template.
VueDX's variation
VueDX is less widely known but follows a similar pattern. It uses a hand-written lightweight SFC parser, converts <template> into TSX, and maps the results back. Its code generation relies on @vue/compiler-dom.
Vue Language Tools and the mapping problem
Vue Language Tools is the third project and inherits this line of thinking. A recurring cost in this design is the SourceMap: both earlier tools had to hand-write their mappings. That burden sits at the center of the approach that Vue Language Tools builds on.