vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js
https://marketplace.visualstudio.com/items?itemName=Vue.volar
MIT License
5.75k stars 388 forks source link

syntax highlight not work in template with `lang="html"` #1756

Open jmarshall9120 opened 2 years ago

jmarshall9120 commented 2 years ago

The closing tags are coming up as unrecognized suddenly in templates, and none of the outputs in the console (ESLint, Prettier). There is no specific output for volar that I see.

image

I'm digging in. It looks like Volar requires a jsconfig.json (which vuter did not). I put that in, but no real change. Any ideas appreciated.

I'm on: Windows 11 Volar 0.40.1 Typescript Vue Plugin: 0.40.1 (not typescript in current project howerver) VS Code: July 2022 (version 1.70)

jmarshall9120 commented 2 years ago

Update: I have found the culprit.

see my so post here, copied below

Okay I figured it out. As it turns out the the lang="html" attribute in the template tag must be removed to make this work.

Funny fact, I actually submitted a ticket to VSCode/Vuter a little while ago where we had broken syntax and determined that a bug made it necessary to include the lang tag.

Odd that the bug has flipflopped, so I guess if you (the reader) happen to be a poor soul experiencing this you will need to try both approaches to determine what your combination of VSCode/Vue language support will accept:

TLDR:

//used to require this in SFC's:
<template lang="html">
</template>
// now requires this with volar
<template>
<template>

As far as I know the lang tag is still HTML standard. You might consider patching this.