summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2024-12-02 20:47:38 -0800
committerYuan Fu <casouri@gmail.com>2024-12-04 22:39:28 -0800
commited9eaaa9964f46ef5f9a9c084a1cb8f1ae1926a3 (patch)
tree114d9042d840686a2286d41bb1d6b0358f846e1b /lisp/emacs-lisp
parent4ecd1639b19345786020c0f7a5f3672129dae466 (diff)
downloademacs-ed9eaaa9964f46ef5f9a9c084a1cb8f1ae1926a3.tar.gz
emacs-ed9eaaa9964f46ef5f9a9c084a1cb8f1ae1926a3.tar.bz2
emacs-ed9eaaa9964f46ef5f9a9c084a1cb8f1ae1926a3.zip
Validate font-lock rules when setting up tree-sitter major mode
When tree-sitter grammar make breaking changes, major modes breaks completely: no highlighting is shown. This new function will run in treesit-major-mode-setup, validate each font-lock features, and disable the ones that are not compatible with the new grammar, so that the rest of the features still work. It also displays a warning explaining the situation, which looks like this: Warning (treesit-font-lock-rules-mismatch): Emacs cannot compile every font-lock rules because a mismatch between the grammar and the rules. This is most likely due to a mismatch between the font-lock rules defined by the major mode and the tree-sitter grammar. This error can be fixed by either downgrading the grammar (tree-sitter-c) on your system, or upgrading the major mode package. The following are the temporarily disabled features: - `preprocessor' for c. * lisp/treesit.el (treesit-validate-font-lock-rules): New function. (treesit-major-mode-setup): Validate font-lock rules.
Diffstat (limited to 'lisp/emacs-lisp')
0 files changed, 0 insertions, 0 deletions