aboutsummaryrefslogtreecommitdiff
path: root/test/functional/treesitter/parser_spec.lua
diff options
context:
space:
mode:
authorJaehwang Jung <tomtomjhj@gmail.com>2023-07-07 19:12:46 +0900
committerGitHub <noreply@github.com>2023-07-07 11:12:46 +0100
commitc44d819ae1f29cd34ee3b2350b5c702caed949c3 (patch)
tree4cccd21d5ddf9c7196224dd72850ea81d40eb3f1 /test/functional/treesitter/parser_spec.lua
parent811140e276a6312775bfcf9b368de25386f7a356 (diff)
downloadrneovim-c44d819ae1f29cd34ee3b2350b5c702caed949c3.tar.gz
rneovim-c44d819ae1f29cd34ee3b2350b5c702caed949c3.tar.bz2
rneovim-c44d819ae1f29cd34ee3b2350b5c702caed949c3.zip
fix(treesitter): update folds in all relevant windows (#24230)
Problem: When using treesitter foldexpr, * :diffput/get open diff folds, and * folds are not updated in other windows that contain the updated buffer. Solution: Update folds in all windows that contain the updated buffer and use expr foldmethod.
Diffstat (limited to 'test/functional/treesitter/parser_spec.lua')
-rw-r--r--test/functional/treesitter/parser_spec.lua81
1 files changed, 0 insertions, 81 deletions
diff --git a/test/functional/treesitter/parser_spec.lua b/test/functional/treesitter/parser_spec.lua
index 7cfe5b69de..ae26b92f52 100644
--- a/test/functional/treesitter/parser_spec.lua
+++ b/test/functional/treesitter/parser_spec.lua
@@ -885,87 +885,6 @@ int x = INT_MAX;
end)
end)
- it("can fold via foldexpr", function()
- insert(test_text)
-
- local function get_fold_levels()
- return exec_lua([[
- local res = {}
- for i = 1, vim.api.nvim_buf_line_count(0) do
- res[i] = vim.treesitter.foldexpr(i)
- end
- return res
- ]])
- end
-
- exec_lua([[vim.treesitter.get_parser(0, "c")]])
-
- eq({
- [1] = '>1',
- [2] = '1',
- [3] = '1',
- [4] = '1',
- [5] = '>2',
- [6] = '2',
- [7] = '2',
- [8] = '1',
- [9] = '1',
- [10] = '>2',
- [11] = '2',
- [12] = '2',
- [13] = '2',
- [14] = '2',
- [15] = '>3',
- [16] = '3',
- [17] = '3',
- [18] = '2',
- [19] = '1' }, get_fold_levels())
-
- helpers.command('1,2d')
-
- eq({
- [1] = '0',
- [2] = '0',
- [3] = '>1',
- [4] = '1',
- [5] = '1',
- [6] = '0',
- [7] = '0',
- [8] = '>1',
- [9] = '1',
- [10] = '1',
- [11] = '1',
- [12] = '1',
- [13] = '>2',
- [14] = '2',
- [15] = '2',
- [16] = '1',
- [17] = '0' }, get_fold_levels())
-
- helpers.command('1put!')
-
- eq({
- [1] = '>1',
- [2] = '1',
- [3] = '1',
- [4] = '1',
- [5] = '>2',
- [6] = '2',
- [7] = '2',
- [8] = '1',
- [9] = '1',
- [10] = '>2',
- [11] = '2',
- [12] = '2',
- [13] = '2',
- [14] = '2',
- [15] = '>3',
- [16] = '3',
- [17] = '3',
- [18] = '2',
- [19] = '1' }, get_fold_levels())
- end)
-
it('tracks the root range properly (#22911)', function()
insert([[
int main() {