From d2a760c83b291e3040cffd9ef6ce941786463a95 Mon Sep 17 00:00:00 2001 From: Erasin Date: Fri, 9 Sep 2022 19:50:50 +0800 Subject: [PATCH 1/3] Add godot resource support --- book/src/generated/lang-support.md | 1 + languages.toml | 15 ++++++++++ runtime/queries/godot-resource/highlights.scm | 28 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 runtime/queries/godot-resource/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index ca7c12481b4a..70609464c47b 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -38,6 +38,7 @@ | gleam | ✓ | ✓ | | `gleam` | | glsl | ✓ | ✓ | ✓ | | | go | ✓ | ✓ | ✓ | `gopls` | +| godot-resource | ✓ | | | | | gomod | ✓ | | | `gopls` | | gotmpl | ✓ | | | `gopls` | | gowork | ✓ | | | `gopls` | diff --git a/languages.toml b/languages.toml index 15fbe7fb15ed..1a3be93c1e61 100644 --- a/languages.toml +++ b/languages.toml @@ -1333,6 +1333,21 @@ indent = { tab-width = 4, unit = " " } name = "gdscript" source = { git = "https://github.com/PrestonKnopp/tree-sitter-gdscript", rev = "2a6abdaa47fcb91397e09a97c7433fd995ea46c6" } +[[language]] +name = "godot-resource" +scope = "source.tscn" +injection-regex = "godot" +file-types = ["tscn","tres"] +shebangs = [] +roots = ["project.godot"] +auto-format = false +comment-token = "#" +indent = { tab-width = 4, unit = "\t" } + +[[grammar]] +name = "godot-resource" +source = { git = "https://github.com/PrestonKnopp/tree-sitter-godot-resource", rev = "b6ef0768711086a86b3297056f9ffb5cc1d77b4a" } + [[language]] name = "nu" scope = "source.nu" diff --git a/runtime/queries/godot-resource/highlights.scm b/runtime/queries/godot-resource/highlights.scm new file mode 100644 index 000000000000..c14be3596c8c --- /dev/null +++ b/runtime/queries/godot-resource/highlights.scm @@ -0,0 +1,28 @@ +(section (identifier) @type.builtin) + +(attribute (identifier) @attribute) +(property (path) @attribute) +(constructor (identifier) @constructor) + +(string) @string +(integer) @constant.numeric.integer +(float) @constant.numberic.float + +(true) @constant.builtin.boolean +(false) @constant.builtin.boolean + +[ + "[" + "]" +] @tag + +[ + "(" + ")" + "{" + "}" +] @punctuation.bracket + +"=" @operator + +(ERROR) @error \ No newline at end of file From 7788faea57c60f6497ac9caec102975b562579b7 Mon Sep 17 00:00:00 2001 From: Erasin Date: Sat, 10 Sep 2022 11:33:20 +0800 Subject: [PATCH 2/3] Update runtime/queries/godot-resource/highlights.scm Co-authored-by: Michael Davis --- runtime/queries/godot-resource/highlights.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/queries/godot-resource/highlights.scm b/runtime/queries/godot-resource/highlights.scm index c14be3596c8c..49c87be9bb13 100644 --- a/runtime/queries/godot-resource/highlights.scm +++ b/runtime/queries/godot-resource/highlights.scm @@ -6,7 +6,7 @@ (string) @string (integer) @constant.numeric.integer -(float) @constant.numberic.float +(float) @constant.numeric.float (true) @constant.builtin.boolean (false) @constant.builtin.boolean From d9425c5d72041e9fa15384eeacf867fceb9556da Mon Sep 17 00:00:00 2001 From: Erasin Date: Sat, 10 Sep 2022 11:33:28 +0800 Subject: [PATCH 3/3] Update runtime/queries/godot-resource/highlights.scm Co-authored-by: Michael Davis --- runtime/queries/godot-resource/highlights.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/queries/godot-resource/highlights.scm b/runtime/queries/godot-resource/highlights.scm index 49c87be9bb13..18dae41fbb81 100644 --- a/runtime/queries/godot-resource/highlights.scm +++ b/runtime/queries/godot-resource/highlights.scm @@ -1,7 +1,7 @@ (section (identifier) @type.builtin) (attribute (identifier) @attribute) -(property (path) @attribute) +(property (path) @variable.other.member) (constructor (identifier) @constructor) (string) @string