atom / language-javascript

JavaScript language package for Atom
Other
194 stars 236 forks source link

Code comments preceding a string to trigger language-appropriate syntax highlighting #693

Open brettz9 opened 3 years ago

brettz9 commented 3 years ago

Summary

Allow code comments like /* html */ which immediately precede a string to trigger language-appropriate syntax highlighting.

Motivation

One sometimes has strings which one does not need or want to use a tagged template literal before it, but does want to trigger highlighting.

In some circumstances, like with hyperHTML, while I can name my render function as html to get the benefits of syntax highlighting, when I have children like within a map that returns a string, the string should not be passed to the same html render function, so the inner content does not get the benefit of syntax highlighting.

image

Describe alternatives you've considered

I could use another function which has its own html, but this is not practical, especially given that it helps to see smaller bits of template content within the larger template when manageable in size.

language-javascript-plus was doing this for a while, but:

  1. It is not working for me at present
  2. It just seems like something which ought to be supported

Thanks!

Additional context