Implement HLSL syntax highlighting, and use HLSL grammar to highlight Cg blocks in ShaderLab files#20129
Implement HLSL syntax highlighting, and use HLSL grammar to highlight Cg blocks in ShaderLab files#20129aeschli merged 2 commits intomicrosoft:masterfrom tgjones:colorize-shaders
Conversation
And use HLSL grammar to highlight CG blocks in ShaderLab shaders.
|
Hi @tgjones, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
|
Hi, I am closing and re-opening this PR to bump the CLA bot. Sorry for the inconvenience! |
|
Hi @tgjones, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
|
@aeschli Can you please take a look at this change. It looks good to me but you know much more about the general language support |
|
@tgjones Thanks a lot Tim for the great work. Separating HLSL and ShaderLab sounds like a good idea. |
|
@aeschli that sounds very sensible to me. In fact I've already created such a repository, because GitHub's Linguist (used for syntax highlighting on github.com) requires grammars to be in a submodule, and I've got an active PR over there for adding HLSL syntax highlighting. I'll modify this PR once I get back to my computer. |
…derLab grammars Related to #20129.
|
Cool. What's missing to the PR is just a grammar update script plus an updated OSSREADME. |
|
Ah, I see https://github.com/tgjones/shaders-tmLanguage. I'll make the update. |
|
Great, thanks for merging! |
Implements #20128.
In contrast to the existing ShaderLab grammar, this new ShaderLab grammar delegates highlighting of Cg blocks to the separate HLSL grammar (which has the advantage that standalone HLSL files can now be highlighted).
I created both the HLSL and ShaderLab grammars by reading the relevant language documentation, so they should both be up-to-date with available types / keywords / etc.
I also looked at the latest
csharp.tmLanguageso that my choice of scope names roughly matches what has been done there.Because
.cgincfiles are basically HLSL files, and not ShaderLab files, I've removed that file extension from the ShaderLab extension and included it in the HLSL extension.For comparison, here's what ShaderLab syntax highlighting looks like in VSCode 1.9:
And here's what it looks like using this new ShaderLab grammar:
This is what standalone HLSL syntax highlighting looks like using the new HLSL grammar:
This is my first contribution to VSCode - I'm very happy to make changes, just let me know what I got wrong :)