Skip to content

Conversation

@sockeye-d
Copy link

This removes export and related keywords from the list of keywords and adds a new rule for highlighting annotations

@Andriamanitra
Copy link
Contributor

I would rather keep old keywords around because someone could be editing code written for an old Godot version.

@sockeye-d
Copy link
Author

Finally got around to fixing this. I

  • added back the Godot 3 keywords
  • added the rest of Godot 4's Variant types
  • replaced the built-in node name highlighting with a more generic one that just highlights all words that start with an uppercase letter
  • Added a new highlighting rule for CONSTANT_CASE constants
Copy link
Contributor

@Andriamanitra Andriamanitra left a comment

Choose a reason for hiding this comment

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

I tested with two GDScript files I found on Github:

Triple quoted strings are missing handling for escaped characters, and I think it would make sense to make triple quoted strings into strings rather than comments (the documentation no longer mentions triple quoted strings as a way to create comments).

Other than that everything seems to look good.

- statement.meta: "@[A-Za-z_][A-Za-z0-9_]*\\b"
# Keywords
- statement: "\\b(and|as|assert|await|break|breakpoint|class|class_name|const|continue|elif|else|enum|export|extends|for|func|get|if|in|is|map|master|mastersync|match|not|onready|or|pass|remote|remotesync|return|self|set|setget|slave|slavesync|signal|sync|tool|var|while|yield)\\b"
- statement: "\\b(and|as|assert|await|break|breakpoint|class|class_name|const|continue|elif|else|enum|export|extends|for|func|get|if|in|is|map|master|mastersync|match|not|onready|or|pass|remote|remotesync|return|self|set|setget|slave|slavesync|signal|static|super|sync|tool|var|when|while|yield)\\b"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- statement: "\\b(and|as|assert|await|break|breakpoint|class|class_name|const|continue|elif|else|enum|export|extends|for|func|get|if|in|is|map|master|mastersync|match|not|onready|or|pass|remote|remotesync|return|self|set|setget|slave|slavesync|signal|static|super|sync|tool|var|when|while|yield)\\b"
- statement: "\\b(and|as|assert|await|break|breakpoint|class|class_name|const|continue|elif|else|enum|export|extends|for|func|get|if|in|is|map|master|mastersync|match|not|onready|or|pass|remote|remotesync|return|self|set|setget|slave|slavesync|signal|static|super|sync|tool|var|void|when|while|yield)\\b"

I'm sorry for missing this last time (copy-paste error)

Comment on lines 34 to +35
- constant: "\\b[0-9]+\\b"
- constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
- constant.number: "-?\\b([0-9]?\\.[0-9]+|[0-9]+|0x[0-9a-fA-F]*)(e-?[0-9]+)?\\b"
Copy link
Contributor

Choose a reason for hiding this comment

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

The constant one can be removed since it's included in constant.number now.

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

Labels

None yet

2 participants