From 5e6240ffc24e55ecf7721fd9dc3f33c6f178be8c Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sat, 20 Apr 2024 10:36:17 -0700 Subject: feat(treesitter): handle quantified fold captures --- test/functional/treesitter/fold_spec.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/functional/treesitter/fold_spec.lua b/test/functional/treesitter/fold_spec.lua index fc0996dd7f..06f97dc9bb 100644 --- a/test/functional/treesitter/fold_spec.lua +++ b/test/functional/treesitter/fold_spec.lua @@ -404,6 +404,28 @@ t3]]) }, get_fold_levels()) end) + it('handles quantified patterns', function() + insert([[ +import hello +import hello +import hello +import hello +import hello +import hello]]) + + exec_lua([[vim.treesitter.query.set('python', 'folds', '(import_statement)+ @fold')]]) + parse('python') + + eq({ + [1] = '>1', + [2] = '1', + [3] = '1', + [4] = '1', + [5] = '1', + [6] = '1', + }, get_fold_levels()) + end) + it('updates folds in all windows', function() local screen = Screen.new(60, 48) screen:attach() -- cgit