aboutsummaryrefslogtreecommitdiffstats
path: root/queries/ruby
diff options
context:
space:
mode:
authorYorick Peterse <yorick@yorickpeterse.com>2021-08-05 16:17:18 +0200
committerThomas Vigouroux <tomvig38@gmail.com>2021-08-09 08:38:02 +0200
commit3fd4d9fb3fc7ea86057e952f6db8f8641c615eb5 (patch)
treef162f68759d61219b00a7256abdddf5cb96e83ee /queries/ruby
parentUpdate lockfile.json (#1679) (diff)
downloadnvim-treesitter-3fd4d9fb3fc7ea86057e952f6db8f8641c615eb5.tar
nvim-treesitter-3fd4d9fb3fc7ea86057e952f6db8f8641c615eb5.tar.gz
nvim-treesitter-3fd4d9fb3fc7ea86057e952f6db8f8641c615eb5.tar.bz2
nvim-treesitter-3fd4d9fb3fc7ea86057e952f6db8f8641c615eb5.tar.lz
nvim-treesitter-3fd4d9fb3fc7ea86057e952f6db8f8641c615eb5.tar.xz
nvim-treesitter-3fd4d9fb3fc7ea86057e952f6db8f8641c615eb5.tar.zst
nvim-treesitter-3fd4d9fb3fc7ea86057e952f6db8f8641c615eb5.zip
Fix instance and singleton method locals for Ruby
Ruby singleton methods (`def x.y ... end`) weren't covered in the list of locals. In addition, instance methods didn't support names that are capitalised (`def Integer ... end`). This commit ensures that both instance and singleton methods are supported, and that both support identifiers and constants as their names. This ensures that all following examples are covered: def foo; end def FOO; end def self.bar; end def self.BAR; end
Diffstat (limited to 'queries/ruby')
-rw-r--r--queries/ruby/locals.scm3
1 files changed, 2 insertions, 1 deletions
diff --git a/queries/ruby/locals.scm b/queries/ruby/locals.scm
index 7c703fd6e..fe85bf209 100644
--- a/queries/ruby/locals.scm
+++ b/queries/ruby/locals.scm
@@ -36,7 +36,8 @@
(module name: (constant) @definition.namespace)
(class name: (constant) @definition.type)
-(method name: (identifier) @definition.function)
+(method name: [(identifier) (constant)] @definition.function)
+(singleton_method name: [(identifier) (constant)] @definition.function)
(method_parameters (identifier) @definition.var)
(lambda_parameters (identifier) @definition.var)