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

GDScript: Improve highlighting of types #82516

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

dalexeev
Copy link
Member

@dalexeev dalexeev commented Sep 29, 2023

  1. Fix highlighting of for loop variable type.
  2. Highlight void, bool, int, and float as types, not as keywords. This is especially good when there is another keyword next to the type (like if a is int or a is float).
  3. Fix highlighting of type chains (like Variant.Type).
  4. Add Ctrl+Click for Variant.

@Calinou
Copy link
Member

Calinou commented Sep 29, 2023

This also resolves #44922 🙂

@MewPurPur
Copy link
Contributor

#82326 is still relevant and not superseded.

Copy link
Contributor

@MewPurPur MewPurPur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me. I'm surprised to see void highlighted as a type - it both makes and doesn't make sense to me as a user. Given the context it always pops up in, I think it's better this way.

@Mickeon
Copy link
Contributor

Mickeon commented Sep 29, 2023

Good lord, thank you for making the numeric types green, it was bothering me for so long.

modules/gdscript/gdscript.cpp Show resolved Hide resolved
modules/gdscript/gdscript.cpp Show resolved Hide resolved
modules/gdscript/gdscript.cpp Outdated Show resolved Hide resolved
@tokengamedev
Copy link

Is it possible to look into this also, if not let me know, I can create a separate issue.

set and get are not colored.
image

Thanks

@dalexeev
Copy link
Member Author

Is it possible to look into this also

Given the way highlighter works, the only solution I see is to highlight all set and get identifiers as method calls. This won't affect identifier parts (like set_name), string literals, comments, etc., but set and get will be highlighted as method calls even without parentheses (if you pass them as Callables). But I think it has more pros than cons.

@tokengamedev
Copy link

I think get and set are not keywords because they can be method names.
In that case it is ok.
Ideally I thought get and set when not methods(without parentheses) should be treated(highlight only) like keywords

@dalexeev
Copy link
Member Author

dalexeev commented Oct 3, 2023

Highlighting set and get as keywords or as method definitions depending on the context is possible, but it is more difficult. I think the simple solution looks good for now.

@akien-mga akien-mga merged commit 2af3229 into godotengine:master Oct 3, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

Missing cases of Variant type syntax highlighting Variant in for loop is not colour coded.
8 participants