GLSL icon indicating copy to clipboard operation
GLSL copied to clipboard

#ifdef directives issue

Open UHFT opened this issue 4 years ago • 2 comments

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

UHFT avatar Jan 08 '21 23:01 UHFT

Screenshot 2021-01-08 at 23 48 58

UHFT avatar Jan 08 '21 23:01 UHFT

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...

danielscherzer avatar Jan 09 '21 09:01 danielscherzer