@@ -354,24 +354,25 @@ impl<'a> CapturedNode<'a> {
354
354
}
355
355
}
356
356
357
- /// The number of matches a TS cursor can at once to avoid performance problems for medium to large files .
358
- /// Set with `set_match_limit`.
359
- /// Using such a limit means that we lose valid captures in , so there is fundamentally a tradeoff here.
357
+ /// The maximum number of in-progress matches a TS cursor can consider at once.
358
+ /// This is set to a constant in order to avoid performance problems for medium to large files. Set with `set_match_limit`.
359
+ /// Using such a limit means that we lose valid captures, so there is fundamentally a tradeoff here.
360
360
///
361
361
///
362
362
/// Old tree sitter versions used a limit of 32 by default until this limit was removed in version `0.19.5` (must now be set manually).
363
363
/// However, this causes performance issues for medium to large files.
364
364
/// In helix, this problem caused treesitter motions to take multiple seconds to complete in medium-sized rust files (3k loc).
365
+ ///
366
+ ///
365
367
/// Neovim also encountered this problem and reintroduced this limit after it was removed upstream
366
368
/// (see <https://github.com/neovim/neovim/issues/14897> and <https://github.com/neovim/neovim/pull/14915>).
367
369
/// The number used here is fundamentally a tradeoff between breaking some obscure edge cases and performance.
368
370
///
369
371
///
370
- /// A value of 64 was chosen because neovim uses that value.
371
- /// Neovim chose this value somewhat arbitrarily (<https://github.com/neovim/neovim/pull/18397>) adjusting it whenever issues occur in practice.
372
- /// However this value has been in use for a long time and due to the large userbase of neovim it is probably a good choice.
373
- /// If this limit causes problems for a grammar in the future, it could be increased.
374
- const TREE_SITTER_MATCH_LIMIT : u32 = 64 ;
372
+ /// Neovim chose 64 for this value somewhat arbitrarily (<https://github.com/neovim/neovim/pull/18397>).
373
+ /// 64 is too low for some languages though. In particular, it breaks some highlighting for record fields in Erlang record definitions.
374
+ /// This number can be increased if new syntax highlight breakages are found, as long as the performance penalty is not too high.
375
+ const TREE_SITTER_MATCH_LIMIT : u32 = 256 ;
375
376
376
377
impl TextObjectQuery {
377
378
/// Run the query on the given node and return sub nodes which match given
0 commit comments