aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorYuan Fu2024-09-08 17:50:52 -0700
committerYuan Fu2024-09-08 20:52:20 -0700
commit3435464452b4947098b8ccbe93e5c0afdd2ed06e (patch)
tree63bb296af999b1cdee76d2ba60f2b383464b7f3e /java
parent3fcec09f754af9822339eff3ea15d43eb7d19014 (diff)
downloademacs-3435464452b4947098b8ccbe93e5c0afdd2ed06e.tar.gz
emacs-3435464452b4947098b8ccbe93e5c0afdd2ed06e.zip
Fix the range handling in treesit.c
1. In treesit_sync_visible_region, reduce the ranges for a parser so it doesn't go beyond the visible range. 2. To avoid possible infinite recursion, add a within_reparse field to parsers. Previously we were using the need_reparse field to avoid infinite recursion, but lisp programs in a parser's after change hook might make some buffer edit which turns need_reparse to true. To avoid that, we now use an explicit field. If a parser's after change function makes a buffer edit, lisp program ends up with a desynced parse tree, but that's better than possible infinite recursion. Also after change function shouldn't edit the buffer. 3. In treesit_make_ranges, use parser's visible_beg instead of buffer's BEGV. I mean technically whenever we make ranges, buffer's BEGV should be equal to parser's visible_beg, but better not take that uncertainty, also makes the code more readable. 4. In Ftreesit_parser_included_ranges, move visible region sync code before the body of the function. * src/treesit.c (treesit_sync_visible_region): Minimally fix ranges so it doesn't exceed parser's visible range. (treesit_call_after_change_functions): Update calling sigature to treesit_make_ranges. (treesit_ensure_parsed, make_treesit_parser): Use the new field within_reparse. (treesit_make_ranges): Use parser's visible_beg instead of buffer's BEGV. (Ftreesit_parser_included_ranges): Move visible region check before function body. * src/treesit.h (Lisp_TS_Parser): Add new field within_reparse.
Diffstat (limited to 'java')
0 files changed, 0 insertions, 0 deletions