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
This commit is contained in:
Yorick Peterse 2021-08-05 16:17:18 +02:00 committed by Thomas Vigouroux
parent f106baa522
commit 3fd4d9fb3f

View file

@ -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)