vscode-shader icon indicating copy to clipboard operation
vscode-shader copied to clipboard

highlight glsl inside javascript / typescript template strings

Open giniedp opened this issue 7 years ago • 2 comments

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 avatar Oct 03 '18 09:10 giniedp

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

giniedp avatar Oct 03 '18 09:10 giniedp

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.

greggman avatar Jan 14 '19 06:01 greggman