diff options
| author | Yuan Fu | 2022-11-15 02:30:50 -0800 |
|---|---|---|
| committer | Yuan Fu | 2022-11-15 02:30:50 -0800 |
| commit | 63f8a838eccf201d6290d0dc8f83881f41785afb (patch) | |
| tree | 00800d9dc117223574fabe640af9dcbe22fda933 /lisp/progmodes/python.el | |
| parent | e0760599b045a7ef3828ae4b624246b6beec2e75 (diff) | |
| download | emacs-63f8a838eccf201d6290d0dc8f83881f41785afb.tar.gz emacs-63f8a838eccf201d6290d0dc8f83881f41785afb.zip | |
Make tree-sitter fontification automatically update
Now nodes that are affected and changed during re-parse will be
correctly refontified. Nodes can change even if it corresponding text
wasn't edited: additional text can complete the parse tree and resolve
error nodes, for example.
* lisp/progmodes/python.el (python-mode): Create Python parser before
calling treesit-major-mode-setup.
* lisp/treesit.el (treesit--font-lock-notifier): New function.
(treesit-major-mode-setup): Register fontifier with every existing
parser.
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 7919484e096..ad4665eb19c 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -6548,6 +6548,7 @@ Add import for undefined name `%s' (empty to skip): " | |||
| 6548 | (cond | 6548 | (cond |
| 6549 | ;; Tree-sitter. | 6549 | ;; Tree-sitter. |
| 6550 | ((treesit-ready-p 'python-mode 'python) | 6550 | ((treesit-ready-p 'python-mode 'python) |
| 6551 | (treesit-parser-create 'python) | ||
| 6551 | (setq-local treesit-font-lock-feature-list | 6552 | (setq-local treesit-font-lock-feature-list |
| 6552 | '(( comment string function-name class-name) | 6553 | '(( comment string function-name class-name) |
| 6553 | ( keyword builtin constant type) | 6554 | ( keyword builtin constant type) |