tgjones / HlslTools

A Visual Studio extension that provides enhanced support for editing High Level Shading Language (HLSL) files
http://timjones.io/blog/archive/2016/04/25/hlsl-tools-for-visual-studio-v1.0-released
Other
562 stars 97 forks source link

How to disable Preprocessor support; #125

Closed asdMild closed 5 years ago

asdMild commented 6 years ago

Preprocessor support is not work well for the shader in ue4

tiantian20007 commented 5 years ago

Came across the same issue. Is there a way to just disable the function that "Gray out code excluded by preprocessor" ?

tgjones commented 5 years ago

The problem is this:

  1. The syntax highlighting in HLSL Tools is derived from the AST - in other words, from knowledge of the parsed code and what each token in the code means, and
  2. The parser completely skips over code that is excluded by the preprocessor.

This is the same thing that Roslyn (the C# compiler) does, so for the same reason it's impossible in Visual Studio to turn this feature off for C# code.

So it's not a case of disabling the feature - the information about how to syntax highlight the excluded code simply isn't there.

I've been looking at alternate methods of syntax highlighting but haven't found yet anything workable yet. Closing this for now unless someone comes up with a good way to implement it.