aboutsummaryrefslogtreecommitdiff
path: root/src/gen/gen_api_dispatch.lua
Commit message (Collapse)AuthorAge
* fix(logging): vimscript API calls #41253Justin M. Keyes2026-08-09
| | | | | | | | | | | | | Problem: ":call nvim_get_mode()" logs a nonsense channel-id: RPC: ch 9223372036854775808: invoke nvim_get_mode Solution: Check `is_internal_call`. Also, skip this logging for RPC calls, because it's redundant with `log_request`/`log_notify`. API: vim -> nvim_get_mode
* feat(options): schema, "dict" options, messagesJustin M. Keyes2026-07-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Options parsing is still painful for dict-style options. Solution: schema-maxxing => better `opt:get()` (will be the basis for `vim.o()`), unified (and more-detailed) err msgs. - Drop bespoke structure-builder in `_core/options.lua`. - Define `schema` for all non-primitive options (except 'guicursor' and statusline-style options); generate reified keysets `OptKeyDict`). - Generate 'fillchars' => `fcs_tab`, 'listchars' => `lcs_tab`. - `nvim_set_option_value`: - Return the improved structures. Also from `vim.opt.x:get()`. - Eliminate api <=> lua roundtrip, centralize option structure handling. - Improve/unify errors. - Bump ERR_BUFLEN 80 → 256 so the "one of" list isn't truncated. - Eliminate old 'diffopt' order-dependence (`iwhiteall` before `iwhite`) Error samples: Typed-key path (opt_strings_check → diffopt/mousescroll/breakindentopt): E474: Unknown item 'foo' E474: 'context' requires a number E474: 'ver' number is out of range E474: 'algorithm' must be one of: myers, minimal, patience, histogram E474: 'filler' does not take a value Related: - #31084 - #34661 - #31820 - #14739 - #20107 - fix #18875 - :get() returns `{ sbr = true, shift = '3' }` (reified-keyset) instead of `{'sbr', 'shift:3'}` - Setting via table now works too. `object_as_optval_for` `is_map` now recognizes struct options. - fix #30296 - instead of `E474: Invalid argument`, errors now look like: ``` E474: Invalid value 'x', expected one of: single, double: ambiwidth=x E474: Unknown item 'foo': diffopt=foo E474: 'context' requires a number: diffopt=context:x ``` simplify `win_float_parse_option` from #26799.
* build(api): unused labels in generated Lua bindings #40880dqnne2026-07-21
| | | | | | | | | | Problem: Generated API bindings for Lua contain unused jump labels when the API function has a non-KeyDict (e.g., Array) param after a KeyDict param, causing the build to fail. Solution: Don't output a label when the current parameter is not a KeyDict but the previous one is.
* feat(docs): mark optional API parametersJustin M. Keyes2026-07-13
|
* feat(api): optional params after `opts` #40720Justin M. Keyes2026-07-13
| | | | | | | | | | | | | | | | | | | | Problem: After 25439dad7e2b, `opts` is optional, but not params that follow it. Solution: - Update `gen_api_dispatch.lua`, docs, tests. - Enhance the `nvim_get_api_info()` api-metadata to include a boolean flag indicating whether a parameter is optional: ``` [type, name, optional] ``` Note: Currently, optional params are assumed to be Dict/Array. Since we don't yet have any use-cases of optional params following `opts`, the build just checks this assumption and we can deal with it later if we ever care to: nvim_get_hl: optional param "foo" has type "Integer" but (currently) we assume Dict/Array
* feat(api): relax contract, `opts` + rest params are optional #40581Barrett Ruth2026-07-13
| | | | | | | | | | | | Problem: |api-contract| allows adding an optional trailing `opts` parameter, but the dispatch generator still requires every parameter, so `opts` cannot be omitted. Solution: Treat a trailing `Dict(...) *opts` parameter as optional in the generated RPC and Lua dispatch wrappers. Co-authored-by: Judit Novak <judit.novak@gmail.com>
* fix(api): preserve ArrayOf metadata #40429Lewis Russell2026-06-26
| | | | | | | | | | | ArrayOf metadata existed before the LuaCATS type documentation refactor and is useful to typed clients consuming api_info(). Keep Tuple metadata normalized to Array, since tuple element types can be mixed, but preserve ArrayOf(...) for exported API metadata. Fixes #38734 AI-assisted: Codex
* feat(cmdwin): implement cmdwin as a normal buf+winJustin M. Keyes2026-06-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: cmdwin (the `:q` cmdline buffer) has various limitations which require special-casing all over the codebase. Besides complicating the code, it also breaks async plugins if they try to create buffers/windows after some work is done, if the user happens to open cmdwin at the wrong the moment: Lua callback: …/guh.nvim/lua/guh/util.lua:531: E11: Invalid in command-line window; <CR> executes, CTRL-C quits stack traceback: [C]: in function 'nvim_buf_delete' …/guh.nvim/lua/guh/util.lua:531: in function <…/guh.nvim/lua/guh/util.lua:526> Solution: Just say no to "inception". Reimplement cmdwin as a normal buffer+window. All of the cmdwin contortions (in both core, and innocent plugins) exist literally only to support "inception": recursive cmdwin-in-cmdline-things, like `<c-r>=`, `/`, search-during-substitute, `:input()`, etc. So we just won't support that (though I have a potential plan for that later, which I call "modal parking lot"). The benefit is that plugins, and core, no longer have to care about cmdwin. BONUS: - mouse-drag on vertical separators works (it only worked for horizontal/statusline before) - inccommand-in-cmdwin now works correctly, for free (thus don't need #40077). POTENTIAL FOLLOWUPS - Drop `CHECK_CMDWIN` ("E11: Invalid in command-line window"), allow chaos. - Unify `BUFLOCK_OK` / `LOCK_OK` ? DESIGN: - Eliminate lots of C globals, `EX_CMDWIN`, etc. - `text_locked()` no longer reports true for cmdwin. - cmdwin = a normal window with 'winfixbuf', 'bufhidden=wipe', 'buftype=nofile'. Invariants come from those options rather than special cases throughout the codebase. - `nv_record` for q:/q//q? calls Lua `nlua_call_vimfn("vim._core.cmdwin", …)`. No `K_CMDWIN` / cmdline-reader detour. - `cedit_key` (`c_CTRL-F`) schedules a deferred event that calls `vim._core.cmdwin.open(type, content, pos)` and returns `Ctrl_C` so the in-flight cmdline cancels. Reader state is not serialized; instead the captured `(type, line, col)` is replayed via `nvim_feedkeys(type..line.."<CR>", "nt", …)` after user confirms. - On confirm/cancel: `<CR>` / `<C-C>` calls into Lua which closes the window and re-feeds the cmdline. BREAKING CHANGES: - Expression-register cmdline (`<C-R>=` from insert-mode) no longer supports cmdwin. Same applies to `input()` / `inputlist()` (already covered by `text_locked`). - Usage of cmdwin in macros/mappings will probably break (assuming they ever worked).
* fix(api): fail fast if `has_lua_imp` retval looks wrong #39866Justin M. Keyes2026-05-20
|
* feat(api): nvim_buf_call, win_call can has multiple return values #39801bfredl2026-05-17
| | | | | | from the "because we can and it is not much code" department. (diffcount excluding tests is actually negative) fixes https://github.com/neovim/neovim/issues/39636#issuecomment-4397141270
* fix: resolve all remaining LuaLS warnings in `src/`Riccardo Mazzarini2026-03-09
|
* fix: silence LuaLS's `no-unknown` warnings in `src/`Riccardo Mazzarini2026-03-09
|
* fix(lua): correct line number reporting for options set in coroutines (#37463)Tommy Guo2026-01-21
|
* refactor(build): split out metadata stepbfredl2025-10-29
| | | | | | | | | | | | | | | This was part of an attempt to add "git describe" to zig build without re-building too much. This doesn't yet work as zig upstream changes are are also needed, but I think this was a sensible refactor even in isolation, so breaking it out. "API dispatch" doesn't depend on any ui event stuff nor on version, that was just an accident of the metadata collection being crammed into the same file. Remove "manual invocation" instruction. this is going to bitrot anyway. Both cmake and build.zig allows you to extract the command line of a step, so you can debug it separately.
* build(ci): bump zig to 0.15.1 and add more platformsbfredl2025-09-15
| | | | | | - Bump zig version to 0.15.1 and workaround zig fetch hang (ziglang/zig#24916) - add mac os zig build (currently without luajit, linker failure) - Add windows zig build, currently with very limited testing
* docs: api eventsJustin M. Keyes2025-09-04
|
* refactor(lua): consistent use of local aliasesChristian Clason2025-08-28
|
* docs(api): document types using LuaCATS typesLewis Russell2025-06-26
| | | | | | | | | | | | | | | | | | | | - Render Lua types in api.txt. - Added `DictAs(name)` API type which acts the same as `Dict` (no parens) when generating the dispatchers, but acts the same as `Dict(name)` when generating docs. - Added `Tuple(...)` API type which is the treated the as `Array` for generating the dispatchers, but is used to document richer types. - Added `Enum(...)` API type to better document enums - Improve typing of some API functions. - Improve c_grammar to properly parse API types and replace string pattern logic in the parsers. - Removed all the hardcoded type overrides in gen_eval_files.lua
* feat(build): build.zig MVP: build and run functionaltests on linuxbfredl2025-05-02
| | | | | | | | | | | | | | | | | | | | | NEW BUILD SYSTEM! This is a MVP implementation which supports building the "nvim" binary, including cross-compilation for some targets. As an example, you can build a aarch64-macos binary from an x86-64-linux-gnu host, or vice versa Add CI target for build.zig currently for functionaltests on linux x86_64 only Follow up items: - praxis for version and dependency bumping - windows 💀 - full integration of libintl and gettext (or a desicion not to) - update help and API metadata files - installation into a $PREFIX - more tests and linters
* docs: misc #32959Justin M. Keyes2025-03-18
|
* build: move all generator scripts to `src/gen/`Lewis Russell2025-02-26
- Move all generator Lua scripts to the `src/gen/` - Add a `.luarc.json` to `src/gen/` - Add a `preload.lua` to `src/gen/` - Add `src` to `package.path` so it aligns with `.luarc.json' - Fix all `require` statements in `src/gen/` so they are consistent: - `require('scripts.foo')` -> `require('gen.foo')` - `require('src.nvim.options')` -> `require('nvim.options')` - `require('api.dispatch_deprecated')` -> `require('nvim.api.dispatch_deprecated')`