Skip to content

Improve the pygments lexer to cover GDScript 2 better #11217

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

Qubus0
Copy link

@Qubus0 Qubus0 commented Aug 19, 2025

we've recently updated the gdscript lexer for our own documentation, this is a port of those changes to fit the godot docs

please check as many pages as you can for errors i might have missed.

also let me know if the colors are fine like this. i think some of the existing colors may be from an older theme and not quite up to date, but i didn't touch them for now.

main changes are functions having proper blue color now, global functions being purple, all classes getting the correct greens (including builtins and types having the different green), and proper colors for $String, string names and node paths

@Qubus0 Qubus0 changed the title expands the pygments lexer to cover GDScript 2 better Improve the pygments lexer to cover GDScript 2 better Aug 19, 2025
@Qubus0
Copy link
Author

Qubus0 commented Aug 19, 2025

Side by side screenshot image LexerUpdate2 LexerUpdate3

@AThousandShips AThousandShips added enhancement content:website Issues related to adding website features and fixing bugs, whether on the front or back-end labels Aug 19, 2025
@AThousandShips AThousandShips requested a review from a team August 19, 2025 16:20
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, it works as expected. Both dark and light theme seem to work.

image image

This is a great start, as it now looks much closer to the Godot script editor (which is the intended goal).

Co-authored-by: Hugo Locurcio <[email protected]>
@@ -440,50 +1406,172 @@ def innerstring_rules(ttype):
Name.Decorator,
),
],
"numbers": [
"operator": [
Copy link
Member

Choose a reason for hiding this comment

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

Any reason this is singular as opposed to other cases?

Copy link
Author

Choose a reason for hiding this comment

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

good question. somewhat arbitrary. name, stringescape, comment and a few others are singular too. for the most part plural would make sense, except whitespace seems awkward. perhaps singular everywhere makes the most sense?

@Qubus0
Copy link
Author

Qubus0 commented Aug 20, 2025

Name and Punctuation didn't have css classes yet. adding them makes the () and = bluish, pretty hard to notice, and fixes code in warning callouts being yellow

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content:website Issues related to adding website features and fixing bugs, whether on the front or back-end enhancement topic:gdscript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants