Skip to content

Implement HLSL syntax highlighting #20128

@tgjones

Description

@tgjones

VSCode already includes built-in syntax highlighting for Unity ShaderLab files. It would be nice to also include built-in syntax highlighting for HLSL files. (And HLSL was created by Microsoft, to give weight to the included-by-default argument.)

ShaderLab files include embedded Cg shaders (between CGPROGRAM/ENDCG or CGINCLUDE/ENDCG delimiters).

As stated here, as far as Unity is concerned, HLSL and Cg can be treated as the same thing:

In Unity, shader programs are written in a variant of HLSL language (also called Cg but for most practical uses the two are the same).

So if we:

  • add HLSL syntax highlighting to VSCode
  • use HLSL syntax highlighting within CGPROGRAM/ENDCG as an embedded grammar

... we can both improve ShaderLab syntax highlighting, and also support HLSL syntax highlighting.

I'm just about to submit a PR with these proposed changes.

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionalitylanguages-basicBasic language support issuesverification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions