Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shader syntax highlighting breaks when preprocessor variable is undefined (regression 4.3-dev6) #91424

Closed
dandeliondino opened this issue May 1, 2024 · 3 comments · Fixed by #91497

Comments

@dandeliondino
Copy link

Tested versions

  • Reproducible in 4.3-dev6
  • Not reproducible in 4.3-dev5

System information

Godot v4.3.dev6 - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3080 Laptop GPU (NVIDIA; 31.0.15.4633) - 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz (16 Threads)

Issue description

In 4.3-dev6, checking for an undefined shader preprocessor variable with #ifdef causes the remainder of the script to lose its syntax highlighting, starting with the #endif line. In 4.3-dev5, the rest of the script would be highlighted as expected. This seems to only affect syntax highlighting, as the shader I discovered this with in my project still compiles and runs correctly.

4.3-dev5
Screenshot 2024-05-01 142945

4.3-dev6
Screenshot 2024-05-01 143043

Steps to reproduce

  • Create a new shader script
  • Define a shader preprocessing variable using #define VARIABLE_NAME
  • Place code inside a check for that variable using #ifdef VARIABLE_NAME (shader code here) #endif
  • Comment out the line that contains #define VARIABLE_NAME
  • Note that, starting with the #endif line, the remainder of the script loses its syntax highlighting

Minimal reproduction project (MRP)

shader-syntax-highlighting.zip

@matheusmdx
Copy link
Contributor

Bisecting points to #90161 as the culprit

image

@akien-mga
Copy link
Member

CC @magian1127

@magian1127
Copy link
Contributor

magian1127 commented May 2, 2024

Highlighting /** */ and /* */ conflicts.
It seems that I need to modify the highlighting code to similar that of GDScript.
We can start by disabling the highlighting for /** */ and temporarily using the same color as /* */.
If there’s no urgency, I’ll submit a pull request later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Not Critical
6 participants