Skip to content

Commit

Permalink
glsl support (helix-editor#993)
Browse files Browse the repository at this point in the history
* add glsl language support

* glsl: use indents.toml file
  • Loading branch information
matszczygiel authored Nov 8, 2021
1 parent 549cdee commit 3f0345f
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@
path = helix-syntax/languages/tree-sitter-cmake
url = https://github.com/uyha/tree-sitter-cmake
shallow = true
[submodule "helix-syntax/languages/tree-sitter-glsl"]
path = helix-syntax/languages/tree-sitter-glsl
url = https://github.com/theHamsta/tree-sitter-glsl.git
shallow = true
[submodule "helix-syntax/languages/tree-sitter-perl"]
path = helix-syntax/languages/tree-sitter-perl
url = https://github.com/ganezdragon/tree-sitter-perl
Expand Down
1 change: 1 addition & 0 deletions helix-syntax/languages/tree-sitter-glsl
Submodule tree-sitter-glsl added at 88408f
8 changes: 8 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,14 @@ comment-token = "#"
indent = { tab-width = 2, unit = " " }
language-server = { command = "cmake-language-server" }

[[language]]
name = "glsl"
scope = "source.glsl"
file-types = ["glsl", "vert", "tesc", "tese", "geom", "frag", "comp" ]
roots = []
comment-token = "//"
indent = { tab-width = 4, unit = " " }

[[language]]
name = "perl"
scope = "source.perl"
Expand Down
1 change: 1 addition & 0 deletions runtime/queries/glsl/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: c
37 changes: 37 additions & 0 deletions runtime/queries/glsl/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
; inherits: c

[
"in"
"out"
"inout"
"uniform"
"shared"
"layout"
"attribute"
"varying"
"buffer"
"coherent"
"readonly"
"writeonly"
"precision"
"highp"
"mediump"
"lowp"
"centroid"
"sample"
"patch"
"smooth"
"flat"
"noperspective"
"invariant"
"precise"
] @keyword

"subroutine" @keyword.function

(extension_storage_class) @attribute

(
(identifier) @variable.builtin
(#match? @variable.builtin "^gl_")
)
19 changes: 19 additions & 0 deletions runtime/queries/glsl/indents.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
indent = [
"init_declarator",
"compound_statement",
"preproc_arg",
"field_declaration_list",
"case_statement",
"conditional_expression",
"enumerator_list",
"struct_specifier",
"compound_literal_expression"
]

outdent = [
"#define",
"#ifdef",
"#endif",
"{",
"}"
]
3 changes: 3 additions & 0 deletions runtime/queries/glsl/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(preproc_arg) @glsl

(comment) @comment
1 change: 1 addition & 0 deletions runtime/queries/glsl/locals.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: c

0 comments on commit 3f0345f

Please sign in to comment.