ruby-ts-mode: Highlight method and block parameters

* lisp/progmodes/ruby-ts-mode.el (ruby-ts--font-lock-settings):
Add rules for method and block parameters.
(ruby-ts-mode): Add corresponding feature.
This commit is contained in:
Dmitry Gutov 2023-01-06 04:48:35 +02:00
parent f1aa306f91
commit 0f5e74f173

View file

@ -290,6 +290,21 @@ values of OVERRIDE"
(method
name: (setter) @font-lock-function-name-face))
:language language
:feature 'parameter-definition
'((method_parameters
(identifier) @font-lock-variable-name-face)
(block_parameters
(identifier) @font-lock-variable-name-face)
(optional_parameter
name: (identifier) @font-lock-variable-name-face)
(splat_parameter
name: (identifier) @font-lock-variable-name-face)
(hash_splat_parameter
name: (identifier) @font-lock-variable-name-face)
(block_parameter
name: (identifier) @font-lock-variable-name-face))
;; Yuan recommends also putting method definitions into the
;; 'function' category (thus keeping it in both). I've opted to
;; just use separate categories for them -- dgutov.
@ -936,7 +951,7 @@ leading double colon is not added."
(setq-local treesit-font-lock-settings (ruby-ts--font-lock-settings 'ruby))
;; Level 3 is the default.
(setq-local treesit-font-lock-feature-list
'(( comment method-definition )
'(( comment method-definition parameter-definition)
( keyword regexp string type)
( builtin-variable builtin-constant constant
delimiter escape-sequence