mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-05 19:59:38 +00:00
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.
This commit is contained in:
parent
d0d3451409
commit
d94dc606a0
1 changed files with 4 additions and 2 deletions
|
@ -208,6 +208,9 @@ values of OVERRIDE"
|
||||||
(treesit-fontify-with-override (max plus-1 start) (min node-end end)
|
(treesit-fontify-with-override (max plus-1 start) (min node-end end)
|
||||||
font-lock-comment-face override)))
|
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)
|
(defun ruby-ts--font-lock-settings (language)
|
||||||
"Tree-sitter font-lock settings for Ruby."
|
"Tree-sitter font-lock settings for Ruby."
|
||||||
(treesit-font-lock-rules
|
(treesit-font-lock-rules
|
||||||
|
@ -336,8 +339,7 @@ values of OVERRIDE"
|
||||||
:language language
|
:language language
|
||||||
:feature 'builtin-function
|
:feature 'builtin-function
|
||||||
`((((identifier) @font-lock-builtin-face)
|
`((((identifier) @font-lock-builtin-face)
|
||||||
(:match ,ruby-ts--builtin-methods
|
(:pred ruby-ts--builtin-method-p @font-lock-builtin-face)))
|
||||||
@font-lock-builtin-face)))
|
|
||||||
|
|
||||||
;; Yuan recommends also putting method definitions into the
|
;; Yuan recommends also putting method definitions into the
|
||||||
;; 'function' category (thus keeping it in both). I've opted to
|
;; 'function' category (thus keeping it in both). I've opted to
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue