aboutsummaryrefslogtreecommitdiff
path: root/test/functional/options/autoread_spec.lua
Commit message (Collapse)AuthorAge
* 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: unreliable "bumps 'busy' on each watched buffer" #40804Justin M. Keyes2026-07-18
| | | | | | | | Problem: Sampling a transient busy=1 pulse is racy under load. Solution: Set a long debounce, assert the stable state, then use a short debounce to let the reload clear it.
* test: unreliable "bumps 'busy' on each watched buffer" #40794Justin M. Keyes2026-07-17
| | | | | | | | | Problem: Test still unreliable. Solution: Don't require both 'busy' pulses to coincide. followup to #40775
* test: unreliable "bumps 'busy' on each watched buffer" #40775Justin M. Keyes2026-07-16
|
* test(autoread): unreliable "coalesces rapid changes via debouncing"Justin M. Keyes2026-07-12
| | | | | | | | | | | | | previous: #40272 FAILED …/autoread_spec.lua @ 142: autoread file watcher coalesces rapid changes via debouncing Expected values to be equal. Expected: 1 Actual: 2 stack traceback: …/autoread_spec.lua:169: in function <…/autoread_spec.lua:142>
* test(autoread): unreliable "coalesces rapid changes via debouncing" #40272Justin M. Keyes2026-06-15
|
* fix(autoread): handle autocmd errorsJustin M. Keyes2026-06-14
| | | | | | | | | | | | | | | | | | | | | | | | | Problem: Any random ftplugin or other autocmd, can throw an error when `:checktime` reloads a buffer. This causes a trace which makes it look like an issue with `autoread.lua`. vim.schedule callback: …/runtime/lua/nvim/autoread.lua:146: FileType Autocommands for "*"..function <SNR>1_LoadFTPlugin[20] ..script …/runtime/ftplugin/help.lua: Vim(runtime):E5113: Lua chunk: …/runtime/lua/vim/treesitter.lua:216: Index out of bounds stack traceback: [C]: in function 'nvim_buf_get_text' …/runtime/lua/vim/treesitter.lua:216: in function 'get_node_text' …/runtime/lua/vim/treesitter/query.lua:558: in function 'handler' …/runtime/lua/vim/treesitter/query.lua:843: in function '_match_predicates' …/runtime/lua/vim/treesitter/query.lua:1082: in function '(for generator)' …/runtime/ftplugin/help.lua:91: in function 'runnables' …/runtime/ftplugin/help.lua:124: in main chunk [C]: in function 'checktime' …/runtime/lua/nvim/autoread.lua:146: in function <…/runtime/lua/nvim/autoread.lua:138> Solution: Use pcall() and surface the error via nvim_echo.
* feat(autoread): surface autoread activity via 'busy' flagJustin M. Keyes2026-06-14
| | | | | | | | | | | | | | | | Problem: Old 'autoread' only did `:checktime` on focus-change and shell (":!") commands, and only for non-hidden buffers. Since 'autoread' is now driven by OS filewatcher events, buffers are updated much more eagerly. This should be surfaced to the user somehow, either via a carefully placed notification, or a minimal UI indicator. A "notification" would be noisy, unless it is conditional on specific circumstances (e.g. when "many" buffers are updated). Solution: Use the existing 'busy' buffer-local option as a subtle hint about activity.
* test(autoread): make "debounce" test actually validJustin M. Keyes2026-06-13
|
* test(autoread): cleanupJustin M. Keyes2026-06-13
| | | | | | - Merged into the main "reloads on external change" test. - Reduce duplication. - Wall-clock down from ~4.4s to ~1.4s (dropped 3s debounce test).
* feat(autoread): use filewatchers for OS-driven change detection #37971Oleksandr Chekhovskyi2026-06-12
Problem: The 'autoread' option only checks for file changes reactively — on FocusGained, :checktime, CmdlineEnter, etc. — by polling timestamps. External changes are not detected until the user interacts with Neovim. Solution: Add a core module (runtime/lua/nvim/autoread.lua) enabled from runtime/plugin/autoread.lua that watches each buffer's file using vim._watch.watch() (libuv fs_event). On change detection it calls :checktime, which invokes the existing buf_check_timestamp() logic for reload/prompt handling. Watchers are managed via autocmds tied to buffer lifecycle events and respect the 'autoread' option (global and buffer-local).