mirror of
https://github.com/godotengine/godot-vscode-plugin.git
synced 2025-12-31 13:48:24 +03:00
Fix GDScript Syntax Highlighting for "self" Keyword (#846)
* Rewrite rules for highlighting "self" --------- Co-authored-by: David Kincaid <daelonsuzuka@gmail.com>
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
# --- IN ---
|
||||
var c = 0
|
||||
|
||||
func f():
|
||||
const a = preload("res://a.gd")
|
||||
const b = load("res://b.gd")
|
||||
@@ -8,3 +11,7 @@ func f():
|
||||
andigin.x = 1
|
||||
|
||||
print(a)
|
||||
|
||||
self.c = 1
|
||||
print(self.c + 2)
|
||||
print(func() return self.c + 2)
|
||||
@@ -1,10 +0,0 @@
|
||||
func f():
|
||||
const a = preload("res://a.gd")
|
||||
const b = load("res://b.gd")
|
||||
|
||||
var origin: Vector2 = Vector2.ZERO
|
||||
origin.x = 1
|
||||
var andigin: Vector2 = Vector2.ZERO
|
||||
andigin.x = 1
|
||||
|
||||
print(a)
|
||||
@@ -76,7 +76,6 @@
|
||||
{ "include": "#function_call" },
|
||||
{ "include": "#region"},
|
||||
{ "include": "#comment" },
|
||||
{ "include": "#self" },
|
||||
{ "include": "#func" },
|
||||
{ "include": "#letter" },
|
||||
{ "include": "#numbers" },
|
||||
@@ -167,24 +166,20 @@
|
||||
{
|
||||
"begin": "(\"|')",
|
||||
"end": "\\1",
|
||||
"name": "string.quoted.gdscript meta.literal.nodepath.gdscript constant.character.escape",
|
||||
"name": "string.quoted.gdscript meta.literal.nodepath.gdscript constant.character.escape.gdscript",
|
||||
"patterns": [
|
||||
{
|
||||
"match": "%",
|
||||
"name": "keyword.control.flow"
|
||||
"name": "keyword.control.flow.gdscript"
|
||||
}
|
||||
]
|
||||
},
|
||||
{ "include": "#expression" }
|
||||
]
|
||||
},
|
||||
"self": {
|
||||
"match": "\\bself\\b",
|
||||
"name": "variable.language.gdscript"
|
||||
},
|
||||
"func": {
|
||||
"match": "\\bfunc\\b",
|
||||
"name": "keyword.language.gdscript"
|
||||
"name": "keyword.language.gdscript storage.type.function.gdscript"
|
||||
},
|
||||
"in_keyword": {
|
||||
"patterns": [
|
||||
@@ -250,7 +245,7 @@
|
||||
"captures": { "1": { "name": "keyword.control.gdscript" } }
|
||||
},
|
||||
"keywords": {
|
||||
"match": "\\b(?:class|class_name|abstract|is|onready|tool|static|export|as|void|enum|assert|breakpoint|sync|remote|master|puppet|slave|remotesync|mastersync|puppetsync|trait|namespace|super)\\b",
|
||||
"match": "\\b(?:class|class_name|abstract|is|onready|tool|static|export|as|void|enum|assert|breakpoint|sync|remote|master|puppet|slave|remotesync|mastersync|puppetsync|trait|namespace|super|self)\\b",
|
||||
"name": "keyword.language.gdscript"
|
||||
},
|
||||
"letter": {
|
||||
|
||||
Reference in New Issue
Block a user