diff options
author | Dmitry Gutov <dgutov@yandex.ru> | 2023-01-20 05:35:12 +0200 |
---|---|---|
committer | Dmitry Gutov <dgutov@yandex.ru> | 2023-01-20 05:35:12 +0200 |
commit | d94dc606a0934e52f86bd939684867ada4b944fe (patch) | |
tree | c8ba8bd86d2dcff9985cb7a08acbd6daae001ce8 /lisp | |
parent | d0d34514097c03d787012478d5217449481cfc04 (diff) | |
download | emacs-d94dc606a0934e52f86bd939684867ada4b944fe.tar.gz emacs-d94dc606a0934e52f86bd939684867ada4b944fe.tar.bz2 emacs-d94dc606a0934e52f86bd939684867ada4b944fe.zip |
ruby-ts-mode: Claw back half of the performance drop from last change
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--builtin-method-p):
New function.
(ruby-ts--font-lock-settings): Use it instead of :match.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/progmodes/ruby-ts-mode.el | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 58da5ef9c69..2105aaaecab 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -208,6 +208,9 @@ values of OVERRIDE" (treesit-fontify-with-override (max plus-1 start) (min node-end end) font-lock-comment-face override))) +(defun ruby-ts--builtin-method-p (node) + (string-match-p ruby-ts--builtin-methods (treesit-node-text node t))) + (defun ruby-ts--font-lock-settings (language) "Tree-sitter font-lock settings for Ruby." (treesit-font-lock-rules @@ -336,8 +339,7 @@ values of OVERRIDE" :language language :feature 'builtin-function `((((identifier) @font-lock-builtin-face) - (:match ,ruby-ts--builtin-methods - @font-lock-builtin-face))) + (:pred ruby-ts--builtin-method-p @font-lock-builtin-face))) ;; Yuan recommends also putting method definitions into the ;; 'function' category (thus keeping it in both). I've opted to |