aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorYuan Fu2024-06-02 21:52:48 -0700
committerYuan Fu2024-06-02 22:33:54 -0700
commit760b54de080c238ea9f7b16055e820862d3e8896 (patch)
tree9fdd84c4a28edfc704fc404ddf28b3391eec33e3 /java
parentb44d511102dd3a94495d8f8446c88ac8898cd58f (diff)
downloademacs-760b54de080c238ea9f7b16055e820862d3e8896.tar.gz
emacs-760b54de080c238ea9f7b16055e820862d3e8896.zip
Use parser notifier to set parser ranges
This is a continuation from an earlier commit where I added treesit-parser-changed-ranges and friends. Dmitry raised an concern about the edge case where the parser re-parses multiple times before treesit--pre-redisplay has a chance to run and process changed ranges. Instead of making treesit-parser-changed-ranges DTRT and become more complicated, it's agreed that using parser notifier is a better solution (and treesit-parser-changed-ranges can probably be removed). So, I took out the code that does the work from treesit--pre-redisplay and put them into treesit--font-lock-mark-ranges-to-fontify. This function will be called on each parser re-parse. And in treesit--pre-redisplay, to ensure that treesit--f-l-m-r-to-f gets called, we force the primary parser to re-parse. I also added a new variable that major modes need to set, treesit-primary-parser. I also added code that makes Emacs guess the primary parser if that variable isn't set. Documentation fot treesit-primary-parser will come later. For futher reference, the message id for the message that prompted this change is <dc94733b-df75-446c-980e-1c8ea65826cf@gutov.dev> * lisp/treesit.el (treesit-primary-parser): New variable. (treesit--font-lock-mark-ranges-to-fontify): New function. (treesit--guess-primary-parser): New function. (treesit--pre-redisplay): Extract out. (treesit--pre-syntax-ppss): Add comments. (treesit-major-mode-setup): Guess and set treesit-primary-parser; add treesit--font-lock-mark-ranges-to-fontify as a notifier to the primary parser.
Diffstat (limited to 'java')
0 files changed, 0 insertions, 0 deletions