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

Template literal syntax highlighting not working in ES6 files #34

Open
getninjaN opened this issue Aug 28, 2018 · 7 comments
Open

Template literal syntax highlighting not working in ES6 files #34

getninjaN opened this issue Aug 28, 2018 · 7 comments

Comments

@getninjaN
Copy link

Hi!
I seem to have a problem with syntax highlighting in my ES6 files, not sure if I'm missing something or not.
I would love for this to work since I moved from Atom to Code, and this worked great in Atom.

image

Code says the language mode is Babel JavaScript.

Any ideas what could be wrong?

@michaelgmcd
Copy link
Owner

The atom package looks for template key in objects and highlights them as mustache templates. Based on #23, it didn't seem like this had much usage so I removed it, or else any object with a template key would have incorrect highlighting.

@getninjaN
Copy link
Author

Hmm... Ok. So how do I get syntax highlighting? :) Could there be a setting for this?

@michaelgmcd
Copy link
Owner

I could probably support the syntax highlighting with a comment, similar to /* CSS */ for some inline css. I'd love a PR as well :)

@michaelgmcd
Copy link
Owner

In order to support this setting, I need vscode to support adding and removing grammars at runtime: microsoft/vscode#61962

@esocode
Copy link

esocode commented Dec 4, 2018

I just installed vscode-language-babel and encountered the same problem. But then I noticed that the CoffeeScript formatting formats templates correctly, so it seems to be possible to achieve this with the current vscode version.

@esocode
Copy link

esocode commented Dec 4, 2018

Addition: I had noticed the problem of templates not beeing styled with .js files, not .es6. And I just discovered that after installing the JavaScript Atom Grammar template literals are now styled correctly with your plugin.

This grammar is provided by Microsoft and contains the following Note: Since the latest update, the JavaScript grammar shipped with VS Code now also supports colorizing of varable and function references and aims to be feature equivalent to the Atom grammar. The VS Code team therefore recommends to use the built-in JavaScript grammar. The "feature equivalency" obviously isn't as complete as advertised.

@michaelgmcd
Copy link
Owner

@esocode please look at #34 (comment). Other highlighting plugins have explicit checks for "template" and highlight them as mustache. I would be interesting in adding custom highlighting like this in a comment but would need VSCode support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants