aboutsummaryrefslogtreecommitdiff
path: root/test/functional/treesitter/fold_spec.lua
Commit message (Collapse)AuthorAge
* fix(treesitter): clamp unbounded fold rangesMilad Rashidikhah2026-07-28
| | | | | | | | | | Problem: Tree-sitter uses UINT32_MAX for full-document ranges, which becomes -1 on 32-bit platforms and reaches _foldupdate as an invalid end row. Solution: Treat negative changed-range end rows as unbounded and clamp them to the buffer line count. Add a regression test that simulates the 32-bit sentinel. AI-assisted: Codex
* test(harness): migrate away from magic globalsJustin M. Keyes2026-07-21
| | | | | | | | | | | | | | | | | | | | | Problem: The magic globals `it`, `describe`, etc., are more trouble than they are worth. - Hooking into `after_each` requires `getfenv()` hacks. - They confuse luals/emmylua, because the top-level `.luarc.json` isn't merged with `test/.luarc.json` (apparently a luals limitation?) - They totally defeat discoverability because the user just has to "know" about the various magic symbols. So they harm DX, which means they serve no purpose at all. Solution: - Expose the test API from `testutil`, so tests can call `t.it()`, `t.describe()`, etc., in the conventional way. - Drop `getfenv()` hacks. - Drop the `setfenv()` injection in `load_chunk`. - Drop `test/_meta.lua`.
* test(treesitter/fold_spec): fix flaky test (#38075)zeertzjq2026-02-26
|
* test: remove a few more redundant clear() calls (#35903)zeertzjq2025-09-24
|
* fix(folds): error when deleting lines at end of buffer #35396tao2025-08-21
| | | | | | | | | | | Problem: with `foldmethod=expr foldexpr=v:lua.vim.treesitter.foldexpr() foldminlines=0`, deleting lines at the end of the buffer always reports an invalid top error, because the top value (i.e. the start line number of the deletion) is always 1 greater than the total line number of the modified buffer. Solution: remove the ml_line_count validation
* test(fold): flaky "doesn't open folds that are not touched" #34911Justin M. Keyes2025-07-13
|
* ci: skip flaky fold test on freebsd/cirrusJustin M. Keyes2025-06-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FAILED test/functional/treesitter/fold_spec.lua @ 720 : treesitter foldexpr doesn't open folds that are not touched test/functional/treesitter/fold_spec.lua:767: Row 1 did not match. Expected: |*{1:-}^t1 | |*{1:-}# h2 | |*{1:│}t2 | |{3:~ }| |{3:~ }| |{3:~ }| |{3:~ }| |1 line less; before #2 {MATCH:.*}| Actual: |*{1: }^t1 | |*{1:+}{2:+-- 2 lines: # h2·····················}| |*{3:~ }| |{3:~ }| |{3:~ }| |{3:~ }| |{3:~ }| |1 line less; before #2 0 seconds ago | To print the expect() call that would assert the current screen state, use screen:snapshot_util(). In case of non-deterministic failures, use screen:redraw_debug() to show all intermediate screen states. Snapshot: screen:expect([[ {1: }^t1 | {1:+}{2:+-- 2 lines: # h2·····················}| {3:~ }|*5 1 line less; before #2 0 seconds ago | ]])
* vim-patch:9.1.1439: Last diff folds not merged (#34380)zeertzjq2025-06-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Last diff folds not merged (after v8.1.1922) Solution: loop over all windows in the current tabpage and update all folds (Gary Johnson) This commit fixes a bug where the last two folds of a diff are not merged when the last difference between the two diff'd buffers is resolved. Normally, when two buffers are diff'd, folding is used to show only the text that differs and to hide the text that is the same between the two buffers. When a difference is resolved by making a block of text the same in both buffers, the folds are updated to merge that block with the folds above and below it into one closed fold. That updating of the folds did not occur when the block of text was the last diff block in the buffers. The bug was introduced by this patch on August 24, 2019: patch 8.1.1922: in diff mode global operations can be very slow Problem: In diff mode global operations can be very slow. Solution: Do not call diff_redraw() many times, call it once when redrawing. And also don't update folds multiple times. Unfortunately, folds were then not updated often enough. The problem was fixed by adding a short loop to the ex_diffgetput() function in diff.c to update all the folds in the current tab when the last difference is removed. A test for this was added to test_diffmode.vim. Two of the reference screen dumps for another test in that file, Test_diffget_diffput_linematch(), had to be changed to have all the folds closed rather than to have the last diff block remain open. closes: vim/vim#17457 https://github.com/vim/vim/commit/3fa0d3514b928e0b21ef24594785f9104a3ffafd Co-authored-by: Gary Johnson <garyjohn@spocom.com>
* test(treesitter): add flaky test to TEST_SKIP_FRAGILE #33912Natanael Copa2025-05-09
| | | ref: https://github.com/neovim/neovim/issues/33910#issuecomment-2863276239
* fix(treesitter): avoid computing fold levels for empty bufferLuuk van Baal2025-02-19
| | | | | | | | Problem: Computing fold levels for an empty buffer (somehow) breaks the parser state, resulting in a broken highlighter and foldexpr. Cached foldexpr parser is invalid after filetype has changed. Solution: Avoid computing fold levels for empty buffer. Clear cached foldinfos upon `FileType`.
* test: use temp file #31907Guilherme Soares2025-01-13
|
* perf(treesitter): don't fetch parser for each fold lineRiley Bruins2025-01-07
| | | | | | | | | | | | | | **Problem:** The treesitter `foldexpr` calls `get_parser()` for each line in the buffer when calculating folds. This can be incredibly slow for buffers where a parser cannot be found (because the result is not cached), and exponentially more so when the user has many `runtimepath`s. **Solution:** Only fetch the parser when it is needed; that is, only when initializing fold data for a buffer. Co-authored-by: Jongwook Choi <wookayin@gmail.com> Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* fix(tests): needing two calls to setup a screen is cringebfredl2024-11-14
| | | | | | | | | | Before calling "attach" a screen object is just a dummy container for (row, col) values whose purpose is to be sent as part of the "attach" function call anyway. Just create the screen in an attached state directly. Keep the complete (row, col, options) config together. It is still completely valid to later detach and re-attach as needed, including to another session.
* test: allow exec_lua to handle functionsLewis Russell2024-08-02
| | | | | | | | | | | Problem: Tests have lots of exec_lua calls which input blocks of code provided as unformatted strings. Solution: Teach exec_lua how to handle functions.
* build(deps): drop unused bundled bash, python parsers and queriesChristian Clason2024-07-09
| | | | | | | | | | Problem: Neovim bundles treesitter parsers for bash and python but does not use them by default. This dilutes the messaging about the bundled parsers being required for functionality or reasonable out-of-the-box experience. It also increases the risk of query incompatibilities for no gain. Solution: Stop bundling bash and python parser and queries.
* fix(treesitter): don't open fold when o/O adds a line below #28709Jaehwang Jung2024-06-20
| | | | | | | | | | | Problem: `o`-ing on a folded line opens the fold, because the new line gets the fold level from the above line (level '='), which extends the fold to the new line. `O` has a similar problem when run on the line below a fold. Solution: Use -1 for the added line to get the lower level from the above/below line.
* test: improve test conventionsdundargoc2024-04-23
| | | | | | | | | Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
* feat(treesitter): handle quantified fold capturesRiley Bruins2024-04-20
|
* refactor(test): inject after_each differentlyLewis Russell2024-04-10
|
* test: improve test conventionsdundargoc2024-04-08
| | | | Work on https://github.com/neovim/neovim/issues/27004.
* revert: "feat(treesitter): add foldtext with treesitter highlighting"Till Bungert2024-01-27
| | | This reverts commit 9ce1623 in favor of #20750.
* feat(treesitter)!: new standard capture namesChristian Clason2024-01-21
| | | | | | | | | | | | | | Problem: Sharing queries with upstream and Helix is difficult due to different capture names. Solution: Define and document a new set of standard captures that matches tree-sitter "standard captures" (where defined) and is closer to Helix' Atom-style nested groups. This is a breaking change for colorschemes that defined highlights based on the old captures. On the other hand, the default colorscheme now defines links for all standard captures (not just those used in bundled queries), improving the out-of-the-box experience.
* refactor: format test/*Justin M. Keyes2024-01-03
|
* fix(lua): memory leak when using invalid syntax with exists() (#26530)zeertzjq2023-12-12
|
* test(treesitter/fold_spec): fix flakiness (#26524)zeertzjq2023-12-12
|
* Merge pull request #26506 from tomtomjhj/tsfoldLewis Russell2023-12-11
|\ | | | | fix(treesitter): improve vim.treesitter.foldexpr
| * test(treesitter): more foldexpr testsJaehwang Jung2023-12-12
| |
* | test: avoid repeated screen lines in expected stateszeertzjq2023-12-09
|/ | | | | | This is the command invoked repeatedly to make the changes: :%s/^\(.*\)|\%(\*\(\d\+\)\)\?$\n\1|\%(\*\(\d\+\)\)\?$/\=submatch(1)..'|*'..(max([str2nr(submatch(2)),1])+max([str2nr(submatch(3)),1]))/g
* fix(treesitter): make Visual hl work consistently with foldtext (#25484)zeertzjq2023-10-03
| | | | | Problem: Visual highlight is inconsistent on a folded line with treesitter foldtext. Solution: Don't added Folded highlight as it is already in background.
* feat(treesitter): add foldtext with treesitter highlighting (#25391)Till Bungert2023-10-01
|
* fix(treesitter): update folds in all relevant windows (#24230)Jaehwang Jung2023-07-07
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.