mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 06:59:22 +01:00
596dfdcf32
## Summary `QueryCursorHandle` returns its cursor to a shared pool on drop. It reset the cursor's byte and point ranges but not `max_start_depth`, and tree-sitter keeps that setting across executions. Only `SyntaxMapMatches` sets a depth, and it sets one on every query. The other pool users never set it: highlight captures, injection queries, `SyntaxLayer::override_id`, and `with_query_cursor`. After a depth-limited matches query, the next of those to take the same cursor matched only nodes within that depth. `Drop` now clears it. The depth-limited queries are the text object queries behind Vim's method, section, and comment motions (`] m`, `] ]`, `] /`), with depths of 3 to 6. Missing highlights after those motions are inferred from the code; only the syntax map is tested. ## Testing `cargo test -p language --lib` passes. `test_max_start_depth_does_not_carry_over_to_later_queries` is new and fails without the fix. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Fixed syntax highlighting sometimes going missing after Vim method, section, and comment motions