From f0843a8d6150154c7a27644b28a26fc444571ee1 Mon Sep 17 00:00:00 2001 From: Vitaly Slobodin Date: Sat, 29 Nov 2025 17:23:19 +0100 Subject: [PATCH 1/2] chore: add `ts_query_ls` config --- .tsqueryrc.json | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .tsqueryrc.json diff --git a/.tsqueryrc.json b/.tsqueryrc.json new file mode 100644 index 0000000..e1d1dbb --- /dev/null +++ b/.tsqueryrc.json @@ -0,0 +1,70 @@ +{ + "$schema": "https://raw.githubusercontent.com/ribru17/ts_query_ls/refs/heads/master/schemas/config.json", + "parser_install_directories": ["./grammars"], + "language_retrieval_patterns": ["languages/([^/]+)/[^/]+\\.scm"], + "parser_aliases": { + "erb": "embedded_template", + "html-erb": "embedded_template", + "js-erb": "embedded_template", + "yaml-erb": "embedded_template" + }, + "valid_captures": { + "highlights": { + "attribute": "An attribute", + "boolean": "A boolean value", + "comment": "A comment", + "comment.doc": "A documentation comment", + "constant": "A constant", + "constant.builtin": "A built-in constant", + "constructor": "A constructor", + "embedded": "Embedded content", + "emphasis": "Emphasized text", + "emphasis.strong": "Strongly emphasized text", + "enum": "An enumeration", + "function": "A function", + "function.builtin": "A built-in function", + "function.method": "A method", + "function.method.builtin": "A built-in method", + "hint": "A hint", + "keyword": "A keyword", + "keyword.exception": "A keyword for exception handling", + "keyword.import": "An import keyword", + "label": "A label", + "link_text": "Link text", + "link_uri": "A link URI", + "number": "A numeric value", + "operator": "An operator", + "predictive": "Predictive text", + "preproc": "A preprocessor directive", + "primary": "A primary element", + "property": "A property", + "punctuation": "Punctuation", + "punctuation.bracket": "A bracket", + "punctuation.delimiter": "A delimiter", + "punctuation.list_marker": "A list marker", + "punctuation.special": "Special punctuation", + "string": "A string literal", + "string.escape": "An escaped character in a string", + "string.regex": "A regular expression", + "string.special": "A special string", + "string.special.symbol": "A special symbol", + "tag": "A tag", + "tag.doctype": "A doctype (e.g., in HTML)", + "text.literal": "Literal text", + "title": "A title", + "type": "A type", + "type.super": "A superclass type", + "variable": "A variable", + "variable.parameter": "A function or method parameter", + "variable.special": "A special variable", + "variant": "A variant" + }, + "runnables": { + "name": "Captures the \"scripts\" key", + "run": "Captures the script name", + "script": "Also captures the script name (for different purposes)", + "RUBY_TEST_NAME": "A ruby test name", + "_ruby-test": "A ruby test name" + } + } +} From 9c65cc81c115441ba9afae88566a235b826043ed Mon Sep 17 00:00:00 2001 From: Vitaly Slobodin Date: Sat, 29 Nov 2025 17:23:45 +0100 Subject: [PATCH 2/2] style: re-format all *.scm files with `ts_query_ls` --- languages/rbs/indents.scm | 14 +- languages/ruby/brackets.scm | 63 ++++-- languages/ruby/debugger.scm | 38 +++- languages/ruby/embedding.scm | 42 ++-- languages/ruby/highlights.scm | 63 ++++-- languages/ruby/indents.scm | 37 ++- languages/ruby/outline.scm | 396 ++++++++++++++++----------------- languages/ruby/runnables.scm | 85 ++++--- languages/ruby/textobjects.scm | 1 - 9 files changed, 404 insertions(+), 335 deletions(-) diff --git a/languages/rbs/indents.scm b/languages/rbs/indents.scm index b37b378..8d53ab1 100644 --- a/languages/rbs/indents.scm +++ b/languages/rbs/indents.scm @@ -7,8 +7,16 @@ (record_type) ] @indent.begin -(_ "[" "]" @end) @indent -(_ "{" "}" @end) @indent -(_ "(" ")" @end) @indent +(_ + "[" + "]" @end) @indent + +(_ + "{" + "}" @end) @indent + +(_ + "(" + ")" @end) @indent (comment) @indent.ignore diff --git a/languages/ruby/brackets.scm b/languages/ruby/brackets.scm index 1e2a75c..7ec8b32 100644 --- a/languages/ruby/brackets.scm +++ b/languages/ruby/brackets.scm @@ -1,15 +1,48 @@ -("(" @open ")" @close) -("[" @open "]" @close) -("{" @open "}" @close) -("\"" @open "\"" @close) -("do" @open "end" @close) - -(block_parameters "|" @open "|" @close) -(interpolation "#{" @open "}" @close) - -(if "if" @open "end" @close) -(unless "unless" @open "end" @close) -(begin "begin" @open "end" @close) -(module "module" @open "end" @close) -(_ . "def" @open "end" @close) -(_ . "class" @open "end" @close) +("(" @open + ")" @close) + +("[" @open + "]" @close) + +("{" @open + "}" @close) + +("\"" @open + "\"" @close) + +("do" @open + "end" @close) + +(block_parameters + "|" @open + "|" @close) + +(interpolation + "#{" @open + "}" @close) + +(if + "if" @open + "end" @close) + +(unless + "unless" @open + "end" @close) + +(begin + "begin" @open + "end" @close) + +(module + "module" @open + "end" @close) + +(_ + . + "def" @open + "end" @close) + +(_ + . + "class" @open + "end" @close) diff --git a/languages/ruby/debugger.scm b/languages/ruby/debugger.scm index 2608a12..c0fe804 100644 --- a/languages/ruby/debugger.scm +++ b/languages/ruby/debugger.scm @@ -1,13 +1,35 @@ -(assignment left: (identifier) @debug-variable) -(assignment left: (call receiver: (identifier) @debug-variable)) -(assignment left: (call method: (identifier) @debug-variable)) -(call (argument_list (call receiver: (identifier) @debug-variable))) -(call (argument_list (call method: (identifier) @debug-variable))) +(assignment + left: (identifier) @debug-variable) -(call (argument_list (identifier) @debug-variable)) +(assignment + left: (call + receiver: (identifier) @debug-variable)) -(method (method_parameters) @debug-variable) -(body_statement (assignment (instance_variable) @debug-variable)) +(assignment + left: (call + method: (identifier) @debug-variable)) + +(call + (argument_list + (call + receiver: (identifier) @debug-variable))) + +(call + (argument_list + (call + method: (identifier) @debug-variable))) + +(call + (argument_list + (identifier) @debug-variable)) + +(method + (method_parameters) @debug-variable) + +(body_statement + (assignment + (instance_variable) @debug-variable)) (program) @debug-scope + (body_statement) @debug-scope diff --git a/languages/ruby/embedding.scm b/languages/ruby/embedding.scm index 7a101e6..df76c0d 100644 --- a/languages/ruby/embedding.scm +++ b/languages/ruby/embedding.scm @@ -1,22 +1,20 @@ -( - (comment)* @context - . - [ - (module - "module" @name - name: (_) @name) - (method - "def" @name - name: (_) @name - body: (body_statement) @collapse) - (class - "class" @name - name: (_) @name) - (singleton_method - "def" @name - object: (_) @name - "." @name - name: (_) @name - body: (body_statement) @collapse) - ] @item - ) +((comment)* @context + . + [ + (module + "module" @name + name: (_) @name) + (method + "def" @name + name: (_) @name + body: (body_statement) @collapse) + (class + "class" @name + name: (_) @name) + (singleton_method + "def" @name + object: (_) @name + "." @name + name: (_) @name + body: (body_statement) @collapse) + ] @item) diff --git a/languages/ruby/highlights.scm b/languages/ruby/highlights.scm index 0b81895..708ea2e 100644 --- a/languages/ruby/highlights.scm +++ b/languages/ruby/highlights.scm @@ -5,7 +5,6 @@ ] @variable ; Keywords - [ "alias" "and" @@ -40,41 +39,63 @@ (#match? @keyword "^(private|protected|public)$")) ; Function calls - (call - method: [(identifier) (constant)] @function.method) + method: [ + (identifier) + (constant) + ] @function.method) ((identifier) @keyword.import - (#any-of? @keyword.import "require" "require_relative" "load")) + (#any-of? @keyword.import "require" "require_relative" "load")) "defined?" @function.method.builtin ; Function definitions - -(alias (identifier) @function.method) -(setter (identifier) @function.method) -(method name: [(identifier) (constant)] @function.method) -(singleton_method name: [(identifier) (constant)] @function.method) -(method_parameters [ - (identifier) @variable.parameter - (optional_parameter name: (identifier) @variable.parameter) - (keyword_parameter [name: (identifier) (":")] @variable.parameter) +(alias + (identifier) @function.method) + +(setter + (identifier) @function.method) + +(method + name: [ + (identifier) + (constant) + ] @function.method) + +(singleton_method + name: [ + (identifier) + (constant) + ] @function.method) + +(method_parameters + [ + (identifier) @variable.parameter + (optional_parameter + name: (identifier) @variable.parameter) + (keyword_parameter + [ + name: (identifier) + ":" + ] @variable.parameter) ]) -(block_parameters (identifier) @variable.parameter) +(block_parameters + (identifier) @variable.parameter) ; Identifiers - ((identifier) @constant.builtin (#match? @constant.builtin "^__(FILE|LINE|ENCODING)__$")) (file) @constant.builtin + (line) @constant.builtin + (encoding) @constant.builtin (hash_splat_nil - "**" @operator -) @constant.builtin + "**" @operator) @constant.builtin (constant) @type @@ -94,6 +115,7 @@ (constant) @type.super))) (self) @variable.special + (super) @variable.special [ @@ -110,7 +132,6 @@ (#any-of? @keyword.exception "raise" "fail" "catch" "throw")) ; Literals - [ (string) (bare_string) @@ -127,6 +148,7 @@ ] @string.special.symbol (regex) @string.regex + (escape_sequence) @string.escape [ @@ -139,9 +161,7 @@ (false) ] @boolean -[ - (nil) -] @constant.builtin +(nil) @constant.builtin ; Regular comments (exclude RBS inline comments) ((comment) @comment @@ -149,7 +169,6 @@ (#not-match? @comment "^\\s*#\\s*(@rbs|\\|)")) ; Operators - [ "!" "~" diff --git a/languages/ruby/indents.scm b/languages/ruby/indents.scm index 5263e7f..89e8da6 100644 --- a/languages/ruby/indents.scm +++ b/languages/ruby/indents.scm @@ -1,9 +1,20 @@ -(method "end" @end) @indent -(class "end" @end) @indent -(module "end" @end) @indent -(begin "end" @end) @indent -(singleton_method "end" @end) @indent -(do_block "end" @end) @indent +(method + "end" @end) @indent + +(class + "end" @end) @indent + +(module + "end" @end) @indent + +(begin + "end" @end) @indent + +(singleton_method + "end" @end) @indent + +(do_block + "end" @end) @indent [ (then) @@ -15,6 +26,14 @@ (rescue) ] @outdent -(_ "[" "]" @end) @indent -(_ "{" "}" @end) @indent -(_ "(" ")" @end) @indent +(_ + "[" + "]" @end) @indent + +(_ + "{" + "}" @end) @indent + +(_ + "(" + ")" @end) @indent diff --git a/languages/ruby/outline.scm b/languages/ruby/outline.scm index ae32c9f..a383f7f 100644 --- a/languages/ruby/outline.scm +++ b/languages/ruby/outline.scm @@ -1,346 +1,322 @@ ; Class definitions, e.g. `class Foo` (class - "class" @context - name: (_) @name) @item + "class" @context + name: (_) @name) @item ; Singleton class definitions `class << self` (singleton_class - "class" @context - "<<" @context - value: (self) @context -) @item + "class" @context + "<<" @context + value: (self) @context) @item ; Method definition with a modifier, e.g. `private def foo` (body_statement - (call - method: (identifier) @context - arguments: (argument_list - (method - "def" @context - name: (_) @name) - )) @item -) + (call + method: (identifier) @context + arguments: (argument_list + (method + "def" @context + name: (_) @name))) @item) -; Method definition without modieifer, e.g. `def foo` +; Method definition without modifier, e.g. `def foo` (body_statement - (method - "def" @context - name: (_) @name) @item -) + (method + "def" @context + name: (_) @name) @item) ; Root method definition with modifier, e.g. `private def foo` (program - (call - method: (identifier) @context - arguments: (argument_list - (method - "def" @context - name: (_) @name) - )) @item -) + (call + method: (identifier) @context + arguments: (argument_list + (method + "def" @context + name: (_) @name))) @item) ; Root method definition without modifier, e.g. `def foo` (program - (method - "def" @context - name: (_) @name) @item -) + (method + "def" @context + name: (_) @name) @item) ; Root singleton method definition, e.g. `def self.foo` (program - (singleton_method - "def" @context - object: (_) @context - "." @context - name: (_) @name) @item -) + (singleton_method + "def" @context + object: (_) @context + "." @context + name: (_) @name) @item) ; Singleton method definition without modifier, e.g. `def self.foo` (body_statement - (singleton_method - "def" @context - object: (_) @context - "." @context - name: (_) @name) @item -) + (singleton_method + "def" @context + object: (_) @context + "." @context + name: (_) @name) @item) ; Singleton method definition with modifier, e.g. `private_class_method def self.foo` (body_statement - (call - method: (identifier) @context - arguments: (argument_list - (singleton_method - "def" @context - object: (_) @context - "." @context - name: (_) @name) @item - )) @item -) + (call + method: (identifier) @context + arguments: (argument_list + (singleton_method + "def" @context + object: (_) @context + "." @context + name: (_) @name) @item)) @item) ; Module definition, e.g. `module Foo` (module - "module" @context - name: (_) @name) @item + "module" @context + name: (_) @name) @item ; Constant assignment -(assignment left: (constant) @name) @item +(assignment + left: (constant) @name) @item ; Class macros such as `alias_method`, `include`, `belongs_to`, `has_many`, `attr_reader` (class - (body_statement - (call - method: (identifier) @name - arguments: (argument_list . [ - (string) @name - (simple_symbol) @name - (scope_resolution) @name - (constant) @name - "," @context - ]* [ - (string) @name - (simple_symbol) @name - (scope_resolution) @name - (constant) @name - ] - ) - ) @item - ) -) + (body_statement + (call + method: (identifier) @name + arguments: (argument_list + . + [ + (string) @name + (simple_symbol) @name + (scope_resolution) @name + (constant) @name + "," @context + ]* + [ + (string) @name + (simple_symbol) @name + (scope_resolution) @name + (constant) @name + ])) @item)) ; Module macros such as `alias_method`, `include` (module - (body_statement - (call - method: (identifier) @name - arguments: (argument_list . [ - (string) @name - (simple_symbol) @name - (scope_resolution) @name - (constant) @name - "," @context - ]* [ - (string) @name - (simple_symbol) @name - (scope_resolution) @name - (constant) @name - ] - ) - ) @item - ) -) + (body_statement + (call + method: (identifier) @name + arguments: (argument_list + . + [ + (string) @name + (simple_symbol) @name + (scope_resolution) @name + (constant) @name + "," @context + ]* + [ + (string) @name + (simple_symbol) @name + (scope_resolution) @name + (constant) @name + ])) @item)) ; Class macros without arguments, such as `private` (class - (body_statement - (identifier) @name @item - ) -) + (body_statement + (identifier) @name @item)) (class - (body_statement - (call - method: (identifier) @name - !arguments - ) @item - ) -) + (body_statement + (call + method: (identifier) @name + !arguments) @item)) ; Module macros without arguments, such as `private` (module - (body_statement - (identifier) @name @item - ) -) + (body_statement + (identifier) @name @item)) (module - (body_statement - (call - method: (identifier) @name - !arguments - ) @item - ) -) + (body_statement + (call + method: (identifier) @name + !arguments) @item)) ; Root test methods (program (call - method: (identifier) @_run @name (#any-of? @_run "describe" "context" "test" "it" "shared_examples") - arguments: (argument_list . [ + method: (identifier) @_run @name + (#any-of? @_run "describe" "context" "test" "it" "shared_examples") + arguments: (argument_list + . + [ (string) @name (simple_symbol) @name (scope_resolution) @name (constant) @name "," @context - ]* [ + ]* + [ (string) @name (simple_symbol) @name (scope_resolution) @name (constant) @name - ] - ) - ) @item -) + ])) @item) ; Nested test methods (call - method: (identifier) @_ctx (#any-of? @_ctx "describe" "context" "shared_examples") - arguments: (argument_list . [ + method: (identifier) @_ctx + (#any-of? @_ctx "describe" "context" "shared_examples") + arguments: (argument_list + . + [ (string) (simple_symbol) (scope_resolution) (constant) - ]+ - ) + ]+) block: (_ (_ (call - method: (identifier) @_run @name (#any-of? @_run "describe" "context" "test" "it" "shared_examples") - arguments: (argument_list . [ + method: (identifier) @_run @name + (#any-of? @_run "describe" "context" "test" "it" "shared_examples") + arguments: (argument_list + . + [ (string) @name (simple_symbol) @name (scope_resolution) @name (constant) @name "," @context - ]* [ + ]* + [ (string) @name (simple_symbol) @name (scope_resolution) @name (constant) @name - ] - ) - ) @item - ) - ) -) + ])) @item))) ; RSpec one-liners (call - method: (identifier) @_ctx (#any-of? @_ctx "describe" "context" "shared_examples") - arguments: (argument_list . [ + method: (identifier) @_ctx + (#any-of? @_ctx "describe" "context" "shared_examples") + arguments: (argument_list + . + [ (string) (simple_symbol) (scope_resolution) (constant) - ]+ - ) + ]+) block: (_ (_ (call - method: (identifier) @_run @name (#any-of? @_run "it") + method: (identifier) @_run @name + (#any-of? @_run "it") block: (block body: (block_body (call - receiver: (identifier) @_expectation (#any-of? @_expectation "is_expected") - method: (identifier) @_negation (#any-of? @_negation "to" "not_to" "to_not") - ) - ) - ) @name - ) @item - ) - ) -) + receiver: (identifier) @_expectation + (#any-of? @_expectation "is_expected") + method: (identifier) @_negation + (#any-of? @_negation "to" "not_to" "to_not")))) @name) @item))) ; Root rake namespace (program (call - method: (identifier) @_namespace @name (#any-of? @_namespace "namespace") - arguments: (argument_list . [ + method: (identifier) @_namespace @name + (#any-of? @_namespace "namespace") + arguments: (argument_list + . + [ (string) @name (simple_symbol) @name - ] - ) - ) @item -) + ])) @item) ; Nested rake namespace (call - method: (identifier) @_parent_namespace (#any-of? @_parent_namespace "namespace") - arguments: (argument_list . [ + method: (identifier) @_parent_namespace + (#any-of? @_parent_namespace "namespace") + arguments: (argument_list + . + [ (string) (simple_symbol) - ]+ - ) + ]+) block: (_ (_ (call - method: (identifier) @_namespace @name (#any-of? @_namespace "namespace") - arguments: (argument_list . [ + method: (identifier) @_namespace @name + (#any-of? @_namespace "namespace") + arguments: (argument_list + . + [ (string) @name (simple_symbol) @name - ] - ) - ) @item - ) - ) -) + ])) @item))) ; Root rake task (program (call - method: (identifier) @_task @name (#any-of? @_task "task") - arguments: (argument_list . [ + method: (identifier) @_task @name + (#any-of? @_task "task") + arguments: (argument_list + . + [ (string) @name (simple_symbol) @name (pair - key: (hash_key_symbol) @name - ) - ] - ) - ) @item -) + key: (hash_key_symbol) @name) + ])) @item) ; Nested rake task (call - method: (identifier) @_namespace (#any-of? @_namespace "namespace") - arguments: (argument_list . [ + method: (identifier) @_namespace + (#any-of? @_namespace "namespace") + arguments: (argument_list + . + [ (string) (simple_symbol) - ]+ - ) + ]+) block: (_ (_ (call - method: (identifier) @_task @name (#any-of? @_task "task") - arguments: (argument_list . [ + method: (identifier) @_task @name + (#any-of? @_task "task") + arguments: (argument_list + . + [ (string) @name (simple_symbol) @name (pair - key: (hash_key_symbol) @name - ) - ] - ) - ) @item - ) - ) -) + key: (hash_key_symbol) @name) + ])) @item))) + ; Single argument methods in schema.rb (call - receiver: (_ (scope_resolution) @_receiver (#eq? @_receiver "ActiveRecord::Schema")) + receiver: (_ + (scope_resolution) @_receiver + (#eq? @_receiver "ActiveRecord::Schema")) block: (_ (_ (call - method: (identifier) @context (#any-of? @context "create_enum" "create_schema" "create_table" "create_virtual_table" "enable_extension") - arguments: (argument_list . [ - (string) @name - ]) - ) @item - ) - ) -) + method: (identifier) @context + (#any-of? @context + "create_enum" "create_schema" "create_table" "create_virtual_table" "enable_extension") + arguments: (argument_list + . + (string) @name)) @item))) ; Double argument methods in schema.rb (call - receiver: (_ (scope_resolution) @_receiver (#eq? @_receiver "ActiveRecord::Schema")) + receiver: (_ + (scope_resolution) @_receiver + (#eq? @_receiver "ActiveRecord::Schema")) block: (_ (_ (call - method: (identifier) @context (#eq? @context "add_foreign_key") - arguments: (argument_list . [ - (string) @name - ] "," [ - (string) @name - ]) - ) @item - ) - ) -) + method: (identifier) @context + (#eq? @context "add_foreign_key") + arguments: (argument_list + . + (string) @name + "," + (string) @name)) @item))) diff --git a/languages/ruby/runnables.scm b/languages/ruby/runnables.scm index 8098ce6..4cc06b3 100644 --- a/languages/ruby/runnables.scm +++ b/languages/ruby/runnables.scm @@ -1,58 +1,53 @@ ; Adapted from the following sources: ; Minitest: https://github.com/zidhuss/neotest-minitest/blob/main/lua/neotest-minitest/init.lua ; RSpec: https://github.com/olimorris/neotest-rspec/blob/main/lua/neotest-rspec/init.lua - ; Tests that inherit from a specific class -( - (class - name: [ - (constant) @run @name @RUBY_TEST_NAME - (scope_resolution scope: (constant) name: (constant) @run) - ] - (superclass (scope_resolution) @superclass (#match? @superclass "(::IntegrationTest|::TestCase|::SystemTestCase|Minitest::Test|TLDR)$")) - ) @_ruby-test - (#set! tag ruby-test) -) +((class + name: [ + (constant) @run @name @RUBY_TEST_NAME + (scope_resolution + scope: (constant) + name: (constant) @run) + ] + (superclass + (scope_resolution) @superclass + (#match? @superclass "(::IntegrationTest|::TestCase|::SystemTestCase|Minitest::Test|TLDR)$"))) @_ruby-test + (#set! tag ruby-test)) -( - (call - method: (identifier) @run (#eq? @run "test") - arguments: (argument_list (string (string_content) @name @RUBY_TEST_NAME)) - ) @_ruby-test - (#set! tag ruby-test) -) +((call + method: (identifier) @run + (#eq? @run "test") + arguments: (argument_list + (string + (string_content) @name @RUBY_TEST_NAME))) @_ruby-test + (#set! tag ruby-test)) ; Methods that begin with test_ -( - (method - name: (identifier) @run @name @RUBY_TEST_NAME (#match? @run "^test_") - ) @_ruby-test - (#set! tag ruby-test) -) +((method + name: (identifier) @run @name @RUBY_TEST_NAME + (#match? @run "^test_")) @_ruby-test + (#set! tag ruby-test)) ; System tests that inherit from ApplicationSystemTestCase -( - (class - name: (constant) @run @name @RUBY_TEST_NAME (superclass) @superclass (#match? @superclass "(ApplicationSystemTestCase)$") - ) @_ruby-test - (#set! tag ruby-test) -) +((class + name: (constant) @run @name @RUBY_TEST_NAME + (superclass) @superclass + (#match? @superclass "(ApplicationSystemTestCase)$")) @_ruby-test + (#set! tag ruby-test)) ; Examples -( - (call - method: (identifier) @run (#any-of? @run "describe" "context" "it" "its" "specify" "feature" "scenario") - arguments: (argument_list . (_) @name @RUBY_TEST_NAME) - ) @_ruby-test - (#set! tag ruby-test) -) +((call + method: (identifier) @run + (#any-of? @run "describe" "context" "it" "its" "specify" "feature" "scenario") + arguments: (argument_list + . + (_) @name @RUBY_TEST_NAME)) @_ruby-test + (#set! tag ruby-test)) ; Examples (one-liner syntax) -( - (call - method: (identifier) @run (#any-of? @run "it" "its" "specify") - block: (_) @name @RUBY_TEST_NAME - !arguments - ) @_ruby-test - (#set! tag ruby-test) -) +((call + method: (identifier) @run + (#any-of? @run "it" "its" "specify") + block: (_) @name @RUBY_TEST_NAME + !arguments) @_ruby-test + (#set! tag ruby-test)) diff --git a/languages/ruby/textobjects.scm b/languages/ruby/textobjects.scm index fa19476..fd78824 100644 --- a/languages/ruby/textobjects.scm +++ b/languages/ruby/textobjects.scm @@ -1,5 +1,4 @@ ; Adapted from https://github.com/helix-editor/helix/blob/master/runtime/queries/ruby/textobjects.scm - ; Class and Modules (class body: (_)? @class.inside) @class.around