GLSL
GLSL copied to clipboard
#ifdef directives issue
Installed product versions
- Visual Studio: 2019 (16.8.3)
Description
syntax highlight of directives (#ifdef and #ifndef) does not work
Steps to recreate
try below without '#define ENABLE_SHADOW'.
float Visivility = 1.0 #ifdef ENABLE_SHADOW Visibility = 0.0 #endif
Current behavior
When ENABLE_SHADOW is not defined then #ifdef - #endif block does not comment out in grey
Expected behavior
When ENABLE_SHADOW is not defined then #ifdef - #endif block should be commented out in grey

Thansk for your feedback! Currently there is no semantik analysis of the code. This would probably require a full fledged syntax tree, which I have not implemented. I just do a simple lexing step with Sprache. I did not want to go to the trouble of implementing a full glsl parser myself, but if you have knowledge of a C# nuget package that does provide a syntax tree (I only know of a Rust implementation (https://docs.rs/glsl/6.0.0/glsl/) and a C/C++ implementation (https://github.com/KhronosGroup/glslang). I can try to include it, but this probably requires a major overhaul of the extension...