From 06b5fda797ea4c363e9fe17b160c33818be8d319 Mon Sep 17 00:00:00 2001 From: GodOfAvacyn <59858208+GodOfAvacyn@users.noreply.github.com> Date: Thu, 29 Feb 2024 02:30:33 -0800 Subject: feat: add support for gdshader (#6153) Godot shading language --------- Co-authored-by: ObserverOfTime --- queries/gdshader/highlights.scm | 142 ++++++++++++++++++++++++++++++++++++++++ queries/gdshader/injections.scm | 2 + 2 files changed, 144 insertions(+) create mode 100644 queries/gdshader/highlights.scm create mode 100644 queries/gdshader/injections.scm (limited to 'queries') diff --git a/queries/gdshader/highlights.scm b/queries/gdshader/highlights.scm new file mode 100644 index 000000000..797681a0c --- /dev/null +++ b/queries/gdshader/highlights.scm @@ -0,0 +1,142 @@ +[ + "render_mode" + "shader_type" + "group_uniforms" + "global" + "instance" + "const" + "varying" + "uniform" + "struct" +] @keyword + +[ + (precision_qualifier) + (interpolation_qualifier) +] @type.qualifier + +[ + "in" + "out" + "inout" +] @keyword.storage + +[ + "while" + "for" +] @keyword.repeat + +[ + "continue" + "break" + "return" +] @keyword.return + +[ + "if" + "else" + "switch" + "case" + "default" +] @keyword.conditional + +[ + "#" + "include" +] @keyword.directive + +(string) @string + +[ + "=" + "+=" + "-=" + "!" + "~" + "+" + "-" + "*" + "/" + "%" + "||" + "&&" + "|" + "^" + "&" + "==" + "!=" + ">" + ">=" + "<=" + "<" + "<<" + ">>" + "++" + "--" +] @operator + +(boolean) @boolean + +(integer) @number + +(float) @number.float + +[ + "." + "," + ";" +] @punctuation.delimiter + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +(builtin_type) @type.builtin + +(ident_type) @type.definition + +[ + (shader_type) + (render_mode) + (hint_name) +] @attribute + +(builtin_variable) @constant.builtin + +(builtin_function) @function.builtin + +(group_uniforms_declaration + group_name: (ident) @property + subgroup_name: (ident) @property) + +(struct_declaration + name: (ident) @type) + +(struct_member + name: (ident) @property) + +(function_declaration + name: (ident) @function) + +(parameter + name: (ident) @variable.parameter) + +(member_expr + member: (ident) @property) + +(call_expr + function: + [ + (ident) + (builtin_type) + ] @function) + +(call_expr + function: (builtin_type) @function.call) + +(comment) @comment @spell diff --git a/queries/gdshader/injections.scm b/queries/gdshader/injections.scm new file mode 100644 index 000000000..2f0e58eb6 --- /dev/null +++ b/queries/gdshader/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) -- cgit v1.2.3-70-g09d2