stef-levesque / vscode-shader

Shader languages support for VS Code
MIT License
157 stars 43 forks source link

highlight glsl inside javascript / typescript template strings #21

Open giniedp opened 6 years ago

giniedp commented 6 years ago

in ES 2015 there is a concept of template literals. More about that here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals

In short: we can write something like this in js/ts

export const mySnippets = {
  foo: glsl`
    # some glsl source code to highlight
  `
}

where glsl is a tagged template

I would love to see syntax highlighting enabled for tagged templates like glsl and hlsl inside js/ts files. This is only about syntax highlighting, there is no need to provide these template functions.

Here is an example extension that does exactly that but with html templates

https://github.com/mjbvz/vscode-lit-html

giniedp commented 6 years ago

there is actually a plugin for that purpose https://github.com/boyswan/vscode-glsl-literal but it currently supports only js files

greggman commented 5 years ago

Let me add, VSCode currently lets handles JS inside <script> tags as well as ``` js code areas inside markdown. It would be great if somehow this plugin could do the same for <script type="glsl"> (or user specified types) as well as markdown areas.