From 692b051b09935653befdb8f7ba8afdb640adf17b Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 12 Jun 2023 09:54:30 -0600 Subject: feat!: drop modules, general refactor and cleanup --- runtime/queries/rbs/folds.scm | 5 ++ runtime/queries/rbs/highlights.scm | 162 +++++++++++++++++++++++++++++++++++++ runtime/queries/rbs/indents.scm | 24 ++++++ runtime/queries/rbs/injections.scm | 2 + 4 files changed, 193 insertions(+) create mode 100644 runtime/queries/rbs/folds.scm create mode 100644 runtime/queries/rbs/highlights.scm create mode 100644 runtime/queries/rbs/indents.scm create mode 100644 runtime/queries/rbs/injections.scm (limited to 'runtime/queries/rbs') diff --git a/runtime/queries/rbs/folds.scm b/runtime/queries/rbs/folds.scm new file mode 100644 index 000000000..ff8e7c588 --- /dev/null +++ b/runtime/queries/rbs/folds.scm @@ -0,0 +1,5 @@ +[ + (class_decl) + (module_decl) + (interface_decl) +] @fold diff --git a/runtime/queries/rbs/highlights.scm b/runtime/queries/rbs/highlights.scm new file mode 100644 index 000000000..9de9c427d --- /dev/null +++ b/runtime/queries/rbs/highlights.scm @@ -0,0 +1,162 @@ +; Use directive +(use_clause + [ + (type_name) + (simple_type_name) + ] @type) + +; Builtin constants and Keywords +[ + "true" + "false" +] @boolean + +"nil" @constant.builtin + +[ + "use" + "as" + "module" + "def" + "attr_reader" + "attr_writer" + "attr_accessor" + "end" + "alias" +] @keyword + +[ + "interface" + "type" + "class" +] @keyword.type + +(class_decl + "end" @keyword.type) + +(interface_decl + "end" @keyword.type) + +"def" @keyword.function + +; Members of declaration +[ + "include" + "extend" + "prepend" +] @function.method + +(visibility) @keyword.modifier + +(comment) @comment @spell + +(method_member + (method_name + [ + (identifier) + (identifier_suffix) + (constant) + (constant_suffix) + (operator) + (setter) + (constant_setter) + ] @function.method)) + +(attribute_member + (method_name + [ + (identifier) + (identifier_suffix) + (constant) + (constant_suffix) + (operator) + (setter) + (constant_setter) + ] @function.method)) + +[ + (ivar_name) + (cvar_name) +] @variable.member + +(alias_member + (method_name) @function) + +(class_name + (constant) @type) + +(module_name + (constant) @type) + +(interface_name + (interface) @type) + +(alias_name + (identifier) @type) + +(type_variable) @constant + +(namespace + (constant) @module) + +(builtin_type) @type.builtin + +(const_name + (constant) @constant) + +(global_name) @variable + +; Standard Arguments +(parameter + (var_name) @variable.parameter) + +; Keyword Arguments +(keyword) @variable.parameter + +; Self +(self) @variable.builtin + +; Literal +(type + (symbol_literal) @string.special.symbol) + +(type + (string_literal + (escape_sequence) @string.escape)) + +(type + (string_literal) @string) + +(type + (integer_literal) @number) + +(type + (record_type + key: (record_key) @string.special.symbol)) + +; Operators +[ + "=" + "->" + "<" + "**" + "*" + "&" + "|" + "^" +] @operator + +; Punctuation +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +[ + "," + "." +] @punctuation.delimiter diff --git a/runtime/queries/rbs/indents.scm b/runtime/queries/rbs/indents.scm new file mode 100644 index 000000000..f6da5b10b --- /dev/null +++ b/runtime/queries/rbs/indents.scm @@ -0,0 +1,24 @@ +[ + (class_decl) + (module_decl) + (interface_decl) + (parameters) + (tuple_type) + (record_type) +] @indent.begin + +[ + "end" + ")" + "]" + "}" +] @indent.end + +[ + "end" + ")" + "}" + "]" +] @indent.branch + +(comment) @indent.auto diff --git a/runtime/queries/rbs/injections.scm b/runtime/queries/rbs/injections.scm new file mode 100644 index 000000000..2f0e58eb6 --- /dev/null +++ b/runtime/queries/rbs/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) -- cgit v1.2.3-70-g09d2