on master help sign in
GN language support (#6969)

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

commitb306b25e82a33b4704846ab4fce9b10b2ee7f67c authorDan Field <dfield@gmail.com> dateSat 18 Nov 2023, 00:11 (3 years ago) parent6bf5548
5 files changed+88
book/src/generated/lang-support.md+1 languages.toml+14 runtime/queries/gn/highlights.scm+42 runtime/queries/gn/injections.scm+15 runtime/queries/gn/locals.scm+16
book/src/generated/lang-support.md+1
@@ -54,6 +54,7 @@
5454| git-rebase | ✓ | | | |
5555| gleam | ✓ | ✓ | | `gleam` |
5656| glsl | ✓ | ✓ | ✓ | |
57+| gn | ✓ | | | |
5758| go | ✓ | ✓ | ✓ | `gopls`, `golangci-lint-langserver` |
5859| godot-resource | ✓ | | | |
5960| gomod | ✓ | | | `gopls` |
languages.toml+14
@@ -2740,6 +2740,20 @@ indent = { tab-width = 4, unit = "\t" }
27402740name = "just"
27412741source = { git = "https://github.com/IndianBoy42/tree-sitter-just", rev = "8af0aab79854aaf25b620a52c39485849922f766" }
27422742
2743+[[language]]
2744+name = "gn"
2745+scope = "source.gn"
2746+injection-regex = "gn"
2747+file-types = ["gn", "gni"]
2748+roots = []
2749+comment-token = "#"
2750+indent = { tab-width = 2, unit = " " }
2751+formatter = { command = "gn", args = ["format", "--stdin"] }
2752+
2753+[[grammar]]
2754+name = "gn"
2755+source = { git = "https://github.com/willcassella/tree-sitter-gn", rev = "e18d6e36a79b20dafb58f19d407bd38b0e60260e" }
2756+
27432757[[language]]
27442758name = "blueprint"
27452759scope = "source.blueprint"
runtime/queries/gn/highlights.scmnew file+42
@@ -0,0 +1,42 @@
1+; Copyright (C) 2021 Will Cassella (github@willcassella.com)
2+;
3+; Licensed under the Apache License, Version 2.0 (the "License");
4+; you may not use this file except in compliance with the License.
5+; You may obtain a copy of the License at
6+;
7+; http://www.apache.org/licenses/LICENSE-2.0
8+;
9+; Unless required by applicable law or agreed to in writing, software
10+; distributed under the License is distributed on an "AS IS" BASIS,
11+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+; See the License for the specific language governing permissions and
13+; limitations under the License.
14+
15+(identifier) @variable.builtin
16+
17+(scope_access field: (_) @variable.other.member)
18+
19+(call target: (_) @function)
20+
21+[ "if" "else" ] @keyword.control.conditional
22+
23+[
24+ (assign_op)
25+ (arithmetic_binary_op)
26+ (comparison_binary_op)
27+ (equivalence_binary_op)
28+ (logical_and_binary_op)
29+ (logical_or_binary_op)
30+ (negation_unary_op)
31+] @operator
32+
33+[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket
34+[ "." "," ] @punctuation.delimiter
35+
36+(string) @string
37+(string_escape) @constant.character.escape
38+(string_expansion [ "$" "${" "}" ] @constant.character.escape)
39+[ (integer) (hex) ] @constant.numeric
40+(boolean) @constant.builtin.boolean
41+
42+(comment) @comment
runtime/queries/gn/injections.scmnew file+15
@@ -0,0 +1,15 @@
1+; Copyright (C) 2021 Will Cassella (github@willcassella.com)
2+;
3+; Licensed under the Apache License, Version 2.0 (the "License");
4+; you may not use this file except in compliance with the License.
5+; You may obtain a copy of the License at
6+;
7+; http://www.apache.org/licenses/LICENSE-2.0
8+;
9+; Unless required by applicable law or agreed to in writing, software
10+; distributed under the License is distributed on an "AS IS" BASIS,
11+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+; See the License for the specific language governing permissions and
13+; limitations under the License.
14+
15+((comment) @injection.content (#set! injection.language "comment"))
runtime/queries/gn/locals.scmnew file+16
@@ -0,0 +1,16 @@
1+; Copyright (C) 2021 Will Cassella (github@willcassella.com)
2+;
3+; Licensed under the Apache License, Version 2.0 (the "License");
4+; you may not use this file except in compliance with the License.
5+; You may obtain a copy of the License at
6+;
7+; http://www.apache.org/licenses/LICENSE-2.0
8+;
9+; Unless required by applicable law or agreed to in writing, software
10+; distributed under the License is distributed on an "AS IS" BASIS,
11+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+; See the License for the specific language governing permissions and
13+; limitations under the License.
14+
15+(source_file) @local.scope
16+(assignment target: (identifier) @local.definition)