-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Add syntax highlighting for glsl.js files #15473
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
Conversation
|
Nice! |
|
Thanks! |
|
Do you know if Sublime Text supports this? @WestLangley will surely appreciate that 😊 |
|
AFAIK not yet. But probably soon using JSCustom syntax package and when the following issue is resolved: Thom1729/Sublime-JS-Custom#49 I guess by using these settings: {
"configurations": {
"My Config": {
"custom_template_tags": {
"/* glsl */": "scope:source.glsl"
}
}
}
} |
|
This is excellent! Should the VSC/Atom instructions go somewhere in the documentation? |
|
Looking forward to checking this out after the holidays!
Probably in the wiki somewhere |
|
I'd like to add this to the wiki, does anyone have a preference for where to put it? Perhaps in this page? https://github.com/mrdoob/three.js/wiki/How-to-contribute-to-three.js |
|
That seems to be a good place 👍 |
|
@mrdoob How do you think, I wanna to commit this tools in |
|
@linbingquan Sounds good to me 👌 |
I made a PR #15522 Result: |
|
FYI, JS Custom now supports this explicitly: {
"configurations": {
"My Config": {
"custom_templates": {
"comments": {
"glsl": "scope:source.glsl"
}
}
}
}
} |
Do you want to keep the cool kid syntaxes with their backticks ` ` without compromises? Missing your favourite syntax highlighting in your shaders? This PR is for you.
The idea is simple: prefix your template string with a comment specifying its syntax and there you have it.
Before:

After:

Tried and tested in both VSCode and Atom:
VSCode
You just need this extension: https://marketplace.visualstudio.com/items?itemName=bierner.comment-tagged-templates
Atom
Install the following packages:
Set your file grammar to
language-babel-extension.Go to Language Babel settings, look for
JavaScript Tagged Template Literal Grammar Extensionsand add/* glsl */:source.glsl.More seriously, I understand this can look like an overhead in the codebase (although that just comments so maybe not) but that might bring back some sanity to the maintainers and contributors when they are trying to update the shader code in their text editors.
Thanks