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 preprocessor #if and #else highlighted with wrong color #78799

Closed
Kinwailo opened this issue Jun 28, 2023 · 2 comments · Fixed by #79112
Closed

Shader preprocessor #if and #else highlighted with wrong color #78799

Kinwailo opened this issue Jun 28, 2023 · 2 comments · Fixed by #79112

Comments

@Kinwailo
Copy link

Kinwailo commented Jun 28, 2023

Godot version

4.0.3

System information

Win7

Issue description

#if and #else highlighted with the color same as if and else shader statement:

image

Steps to reproduce

  1. Create shader
  2. Add #if and #else

Minimal reproduction project

N/A

@Calinou
Copy link
Member

Calinou commented Jun 28, 2023

Syntax highlighting keywords in CodeEdit can't contain symbols like #, so this is a limitation we can't fix directly. Otherwise, we could add all preprocessor keywords as keywords and give them their own color (similar to the @annotation color in GDScript).

The GDScript syntax highlighter uses a custom system to declare annotation colors, which is not available in the "generic" syntax highlighter used for shaders.

@bitsawer
Copy link
Member

We could probably change the preprocessor keywords to use control flow keyword colors, that way they would be at least consistent. Currently they mix control flow and normal shader keyword colors because they conflict with normal shader keywords, which can look a bit weird. I'll probably make a PR at some point, this has been bugging me a bit, too. It's a simple change, looks like this:

colors

Long term solution would be to create an improved syntax highlighter as Calinou said, but there tends to more important tasks at hand currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants