From 646c6e9026a91399805bd3f4c59ec10e8272afe7 Mon Sep 17 00:00:00 2001 From: Syed Daanish Date: Wed, 10 Dec 2025 22:09:24 +0000 Subject: [PATCH] Add periodic forced tree-sitter update --- src/ts.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ts.cc b/src/ts.cc index 1c41b67..c5f23b2 100644 --- a/src/ts.cc +++ b/src/ts.cc @@ -172,6 +172,7 @@ static inline Highlight *safe_get(std::vector &vec, size_t index) { } void ts_collect_spans(Editor *editor) { + static int parse_counter = 0; if (!editor->parser || !editor->root || !editor->query) return; TSInput tsinput = { @@ -194,10 +195,12 @@ void ts_collect_spans(Editor *editor) { edits.push_back(edit); ts_tree_edit(copy, &edits.back()); }; - if (copy && edits.empty()) { + if (copy && edits.empty() && parse_counter < 64) { + parse_counter++; ts_tree_delete(copy); return; } + parse_counter = 0; editor->spans.mid_parse = true; // TODO: Remove this lock and replace with an index // modifier based on edits made in the `read_ts` function.