aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/fast_spec.lua
Commit message (Collapse)AuthorAge
* feat(api): nvim_chan_set()Justin M. Keyes11 days
| | | | | | | | | | | | | | | | | | | Problem: Only the stdio channel can "own" a server (self-exit on close). After :restart the TUI reconnects over a socket, so the restarted server does not have "self-exit" behavior when the channel closes (e.g. by UI disconnect, host-terminal close, etc.), which leaves a dangling server. Solution: - Introduce `nvim_chan_set`. (`nvim_set_client_info` doesn't fit: exposing it to Lua would require a `channel` param, which is not backwards-compatible, plus it's awkward because it doesn't merge info.) - Broadcast per-channel properties in the "restart" UI event as an opaque dict (a potentially useful pattern for other UI-events in the future). - UIs are expected to restore the channel properties on restart. - `nvim_get_chan_info()` reports "detach". - Remove `nvim__chan_set_detach()`.
* 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`.
* feat(api): mark nvim_create_autocmd as api-fast #40836Justin M. Keyes2026-07-19
| | | | | | | | | | | | | | | | | | | | | | | | Problem: nvim_create_autocmd() isn't |api-fast|, so modules that create autocmds (e.g. vim.treesitter.query) can't be require()d in a fast event context. Solution: Mark it |api-fast|. Compile autocmd patterns with RE_NOBREAK so aucmd_next() won't os_breakcheck() mid-iteration, where a fast nvim_create_autocmd() could realloc the autocmds vector and dangle the caller's AutoPat/AutoCmd. RE_NOBREAK is low-risk because: - aucmd_next()'s loop checks CTRL-C: `(for (… i < apc->ausize && !got_int; …)`. - `line_breakcheck()` (`autocmd.c:1912`) runs once per matched autocmd. - Each autocmd _execution_ runs through `do_cmdline`, which has its own breakchecks. However this does admit risk of a pathological case: a catastrophic-backtracking glob matched against a very long `User` event-pattern. Co-authored-by: Riley Bruins <ribru17@hotmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* feat(eval): declare more "fast" functions #40834Justin M. Keyes2026-07-19