Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Support for HTML highlighting in "template literal" strings in .JS files? #3716

Open
wallheater opened this issue Jan 21, 2024 · 0 comments

Comments

@wallheater
Copy link

I am working with Vue 3 without a build/compile step, using:

  • .js files instead of .vue files
  • template property in the component JS instead of <script> and <template> tags

...just like this example.

It is working well for me, except there is no syntax highlighting in the template content in VS Code, when in the JavaScript language mode. (And of course in HTML mode there is no syntax highlighting in the JS.)

Today I added the Vetur extension and tried all the vue-* language modes, and none seems to detect the template block. Is there any way to enable this in the extension?

(Also, is it correct to call this a "template literal"? It's been hard to google this topic.)

Similar concept in the es6-string-html extension, which depends on /*html*/ comments.

Code example linked above:

// my-component.js
export default {
  data() {
    return { count: 0 }
  },
  template: `<div>count is {{ count }}</div>`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant