From 0f5e74f17349dde4bd561f2a703a2bb2c4b97c54 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Fri, 6 Jan 2023 04:48:35 +0200 Subject: [PATCH] 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. --- lisp/progmodes/ruby-ts-mode.el | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 9416b650eb1..349318e7579 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -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 -- 2.39.2