aboutsummaryrefslogtreecommitdiff
path: root/test/functional/treesitter/fold_spec.lua
diff options
context:
space:
mode:
authorTill Bungert <tillbungert@gmail.com>2024-01-27 01:38:56 +0100
committerGitHub <noreply@github.com>2024-01-27 08:38:56 +0800
commit0892c080d16776366a2fe289f9083cdc532ec56c (patch)
treeea18dcaebb1c94a7ac641b1181f4c4cdf76f7691 /test/functional/treesitter/fold_spec.lua
parenta9df0c5ce6caa5e623c3140a80baf4b3c1ce07db (diff)
downloadrneovim-0892c080d16776366a2fe289f9083cdc532ec56c.tar.gz
rneovim-0892c080d16776366a2fe289f9083cdc532ec56c.tar.bz2
rneovim-0892c080d16776366a2fe289f9083cdc532ec56c.zip
revert: "feat(treesitter): add foldtext with treesitter highlighting"
This reverts commit 9ce1623 in favor of #20750.
Diffstat (limited to 'test/functional/treesitter/fold_spec.lua')
-rw-r--r--test/functional/treesitter/fold_spec.lua123
1 files changed, 0 insertions, 123 deletions
diff --git a/test/functional/treesitter/fold_spec.lua b/test/functional/treesitter/fold_spec.lua
index ac9d227bb6..9428432f66 100644
--- a/test/functional/treesitter/fold_spec.lua
+++ b/test/functional/treesitter/fold_spec.lua
@@ -675,126 +675,3 @@ t2]])
}
end)
end)
-
-describe('treesitter foldtext', function()
- local test_text = [[
-void qsort(void *base, size_t nel, size_t width, int (*compar)(const void *, const void *))
-{
- int width = INT_MAX, height = INT_MAX;
- bool ext_widgets[kUIExtCount];
- for (UIExtension i = 0; (int)i < kUIExtCount; i++) {
- ext_widgets[i] = true;
- }
-
- bool inclusive = ui_override();
- for (size_t i = 0; i < ui_count; i++) {
- UI *ui = uis[i];
- width = MIN(ui->width, width);
- height = MIN(ui->height, height);
- foo = BAR(ui->bazaar, bazaar);
- for (UIExtension j = 0; (int)j < kUIExtCount; j++) {
- ext_widgets[j] &= (ui->ui_ext[j] || inclusive);
- }
- }
-}]]
- local screen
-
- before_each(function()
- screen = Screen.new(60, 5)
- screen:set_default_attr_ids({
- [0] = { foreground = Screen.colors.Blue, bold = true },
- [1] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGray },
- [2] = {
- bold = true,
- background = Screen.colors.LightGray,
- foreground = Screen.colors.SeaGreen,
- },
- [3] = { foreground = Screen.colors.DarkCyan, background = Screen.colors.LightGray },
- [4] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.LightGray },
- [5] = { bold = true, background = Screen.colors.LightGray, foreground = Screen.colors.Brown },
- [6] = { background = Screen.colors.Red1 },
- [7] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.Red },
- [8] = { foreground = Screen.colors.Brown, bold = true, background = Screen.colors.Red },
- [9] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.Red },
- [10] = { bold = true },
- })
- screen:attach()
- end)
-
- it('displays highlighted content', function()
- command([[set foldmethod=manual foldtext=v:lua.vim.treesitter.foldtext() updatetime=50]])
- insert(test_text)
- exec_lua([[vim.treesitter.get_parser(0, "c")]])
-
- feed('ggVGzf')
- screen:expect {
- grid = [[
- {4:^void}{1: }{3:qsort}{4:(void}{1: }{5:*}{3:base}{4:,}{1: }{4:size_t}{1: }{3:nel}{4:,}{1: }{4:size_t}{1: }{3:width}{4:,}{1: }{4:int}{1: }{4:(}{5:*}{3:compa}|
- {0:~ }|*3
- |
- ]],
- }
- end)
-
- it('handles deep nested captures', function()
- command([[set foldmethod=manual foldtext=v:lua.vim.treesitter.foldtext() updatetime=50]])
- insert([[
-function FoldInfo.new()
- return setmetatable({
- start_counts = {},
- stop_counts = {},
- levels0 = {},
- levels = {},
- }, FoldInfo)
-end]])
- exec_lua([[vim.treesitter.get_parser(0, "lua")]])
-
- feed('ggjVGkzfgg')
- screen:expect {
- grid = [[
- ^function FoldInfo.new() |
- {1: }{5:return}{1: }{4:setmetatable({}{1:·····································}|
- end |
- {0:~ }|
- |
- ]],
- }
-
- command('hi! Visual guibg=Red')
- feed('GVgg')
- screen:expect {
- grid = [[
- ^f{6:unction FoldInfo.new()} |
- {7: }{8:return}{7: }{9:setmetatable({}{7:·····································}|
- {6:end} |
- {0:~ }|
- {10:-- VISUAL LINE --} |
- ]],
- }
-
- feed('10l<C-V>')
- screen:expect {
- grid = [[
- {6:function F}^oldInfo.new() |
- {7: }{8:return}{7: }{9:se}{4:tmetatable({}{1:·····································}|
- {6:end} |
- {0:~ }|
- {10:-- VISUAL BLOCK --} |
- ]],
- }
- end)
-
- it('falls back to default', function()
- command([[set foldmethod=manual foldtext=v:lua.vim.treesitter.foldtext()]])
- insert(test_text)
-
- feed('ggVGzf')
- screen:expect {
- grid = [[
- {1:^+-- 19 lines: void qsort(void *base, size_t nel, size_t widt}|
- {0:~ }|*3
- |
- ]],
- }
- end)
-end)