diff options
| -rw-r--r-- | lisp/treesit.el | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lisp/treesit.el b/lisp/treesit.el index e53d5d53bd0..7a604121c4e 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el | |||
| @@ -2415,11 +2415,15 @@ in the region." | |||
| 2415 | (window-start) (window-end) treesit--explorer-language)) | 2415 | (window-start) (window-end) treesit--explorer-language)) |
| 2416 | ;; Only highlight the current top-level construct. | 2416 | ;; Only highlight the current top-level construct. |
| 2417 | ;; Highlighting the whole buffer is slow and unnecessary. | 2417 | ;; Highlighting the whole buffer is slow and unnecessary. |
| 2418 | (top-level (treesit-node-first-child-for-pos | 2418 | ;; But if the buffer is small (ie, used in playground |
| 2419 | root (if (eolp) | 2419 | ;; style), just highlight the whole buffer. |
| 2420 | (max (point-min) (1- (point))) | 2420 | (top-level (if (< (buffer-size) 4000) |
| 2421 | (point)) | 2421 | root |
| 2422 | t)) | 2422 | (treesit-node-first-child-for-pos |
| 2423 | root (if (eolp) | ||
| 2424 | (max (point-min) (1- (point))) | ||
| 2425 | (point)) | ||
| 2426 | t))) | ||
| 2423 | ;; Only highlight node when region is active, if we | 2427 | ;; Only highlight node when region is active, if we |
| 2424 | ;; highlight node at point the syntax tree is too jumpy. | 2428 | ;; highlight node at point the syntax tree is too jumpy. |
| 2425 | (nodes-hl | 2429 | (nodes-hl |