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

Improved GDScript.tmLanguage.json #740

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

Conversation

nodlag
Copy link

@nodlag nodlag commented Oct 20, 2024

Added:
as
@export_category
#region
#endregion

Improved to better colors themes:
int|float|bool

Improved nodepath vars like this example:
@onready var grid_ui: CanvasLayer = $GridUI
@onready var grid_container: GridContainer = $GridUI/MarginContainer/GridContainer

Improved const color

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.

Makes sense to me.

Please rebase to fix merge conflicts 🙂 See PR workflow for instructions.

Added:
as
@export_category

Improved to better colors themes:
int|float|bool

Improved nodepath vars like this example:
@onready var grid_ui: CanvasLayer = $GridUI
@onready var grid_container: GridContainer = $GridUI/MarginContainer/GridContainer

Improved constants.
@@ -302,10 +314,10 @@
"name": "keyword.operator.assignment.gdscript"
},
{
"match": "(:)\\s*([a-zA-Z_]\\w*)?",
"match": "(:)\\s*\\b(int|float|bool)\\b",
Copy link
Collaborator

Choose a reason for hiding this comment

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

This rule needs to match any valid type, why did you change it to int|float|bool?

Copy link
Author

Choose a reason for hiding this comment

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

Because in Godot the 3 vars are highlighted separated than others. I not sure if more vars types are like this 3.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds like Godot is wrong, then.

"class_enum": {
"match": "\\b([A-Z][a-zA-Z_0-9]*)\\.([A-Z_0-9]+)",
"captures": {
"1": { "name": "entity.name.type.class.gdscript" },
"2": { "name": "variable.other.enummember.gdscript" }
"2": { "name": "constant.language.gdscript" }
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is overwriting a change that was just merged in #737, please revert this.

}
}
]
},
"annotations": {
"match": "(@)(export|export_color_no_alpha|export_custom|export_dir|export_enum|export_exp_easing|export_file|export_flags|export_flags_2d_navigation|export_flags_2d_physics|export_flags_2d_render|export_flags_3d_navigation|export_flags_3d_physics|export_flags_3d_render|export_global_dir|export_global_file|export_multiline|export_node_path|export_placeholder|export_range|export_storage|icon|onready|rpc|tool|warning_ignore|abstract|static_unload)\\b",
"match": "(@)(export|export_color_no_alpha|export_custom|export_category|export_dir|export_enum|export_exp_easing|export_file|export_flags|export_flags_2d_navigation|export_flags_2d_physics|export_flags_2d_render|export_flags_3d_navigation|export_flags_3d_physics|export_flags_3d_render|export_global_dir|export_global_file|export_multiline|export_node_path|export_placeholder|export_range|export_storage|icon|onready|rpc|tool|warning_ignore|abstract)\\b",
Copy link
Collaborator

Choose a reason for hiding this comment

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

static_unload was just added in #738, and you're removing it here.

Copy link
Author

Choose a reason for hiding this comment

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

Yes I didn't see static_unload because when i push the first changes it wasn't. You are right.

"captures": {
"1": { "name": "entity.name.function.decorator.gdscript" },
"2": { "name": "entity.name.function.decorator.gdscript" }
}
},
"builtin_classes": {
"match": "(?<![^.]\\.|:)\\b(Vector2|Vector2i|Vector3|Vector3i|Vector4|Vector4i|Color|Rect2|Rect2i|Array|Basis|Dictionary|Plane|Quat|RID|Rect3|Transform|Transform2D|Transform3D|AABB|String|Color|NodePath|PoolByteArray|PoolIntArray|PoolRealArray|PoolStringArray|PoolVector2Array|PoolVector3Array|PoolColorArray|bool|int|float|Signal|Callable|StringName|Quaternion|Projection|PackedByteArray|PackedInt32Array|PackedInt64Array|PackedFloat32Array|PackedFloat64Array|PackedStringArray|PackedVector2Array|PackedVector2iArray|PackedVector3Array|PackedVector3iArray|PackedVector4Array|PackedColorArray|super)\\b",
"match": "(?<![^.]\\.|:)\\b(Vector2|Vector2i|Vector3|Vector3i|Color|Rect2|Rect2i|Array|Basis|Dictionary|Plane|Quat|RID|Rect3|Transform|Transform2D|Transform3D|AABB|String|Color|NodePath|PoolByteArray|PoolIntArray|PoolRealArray|PoolStringArray|PoolVector2Array|PoolVector3Array|PoolColorArray|bool|int|float|StringName|Quaternion|PackedByteArray|PackedInt32Array|PackedInt64Array|PackedFloat32Array|PackedFloat64Array|PackedStringArray|PackedVector2Array|PackedVector2iArray|PackedVector3Array|PackedVector3iArray|PackedColorArray|super)\\b",
Copy link
Collaborator

Choose a reason for hiding this comment

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

This line is removing several types that were added in #738.

Copy link
Author

Choose a reason for hiding this comment

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

The same of the previous comment.

"const_vars": {
"match": "\\b([A-Z_][A-Z_0-9]*)\\b",
"name": "variable.other.constant.gdscript"
"name": "constant.language.gdscript"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is overwriting a change that was just made in #737.

"keyword_type_float": {
"match": "(?<![^.]\\.|:)\\b(float)\\b",
"name": "keyword.type.float.gdscript"
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

float is a type, not a keyword, so I don't know what this rule is supposed to achieve.

This rule also does not appear to be included anywhere, so it's not even doing anything.

"1": { "name": "keyword.language.gdscript" },
"2": { "name": "entity.other.inherited-class.gdscript" }
"1": { "name": "entity.other.inherited-class.gdscript" },
"2": { "name": "keyword.language.gdscript" }
Copy link
Collaborator

Choose a reason for hiding this comment

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

What exactly is the intention here?

@@ -250,7 +254,15 @@
},
"letter": {
"match": "\\b(?:true|false|null)\\b",
"name": "constant.language.gdscript"
"name": "constant.language.boolean.gdscript"
Copy link
Collaborator

Choose a reason for hiding this comment

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

null isn't a boolean, so this is actually less accurate than it was before.

Copy link
Author

Choose a reason for hiding this comment

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

Right it was for the highlighting. This should be separated.

Copy link
Collaborator

Choose a reason for hiding this comment

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

constant.language and constant.language.boolean appear to be highlighted the same, so I don't know what you mean here.

"1": { "name": "storage.type.as.gdscript" },
"2": { "name": "entity.name.type.class.gdscript" }
}
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

foo as class is already highlighted correctly as far as I can tell, so what is the purpose of this rule?

@nodlag
Copy link
Author

nodlag commented Oct 24, 2024

I have reverted, I will fix properly.

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.

3 participants