aboutsummaryrefslogtreecommitdiff
path: root/src/gen
Commit message (Collapse)AuthorAge
* docs(help): specify h4 "function signature" format #42434masterJustin M. Keyes2 days
| | | | | | | | | | | | | | | | | | | | | Work towards enabling ["flow" layout](https://github.com/neovim/neovim/blob/9244da12e400ec0291450a5e9400d995e7a29b83/src/gen/gen_help_html.lua#L86-L88) in all `:help` files. Problem: The final boss of vimdoc pseudo-structure: Vim's quasi-headings on function signatures and excmd docs is visually distinctive but too inconsistent for a nice parse rule. Solution: - Define the quasi-heading format as an "h4" variant, specified at `:help help-tag-heading`. - For simplicity and predictability, it is defined as any line that ends with a help tag(s) preceded by 2 or more spaces (or 1 tab). - Update existing docs. - This one-time update has a lot of changes, but is very unlikely to conflict with ported Vim-patches because (1) Vim rarely adds new *excmds* that we want, and (2) *function* docs are auto-generated. ref https://github.com/neovim/tree-sitter-vimdoc/issues/110
* docs: flow layoutJustin M. Keyes3 days
| | | | | | | | | | Work towards enabling "flow" layout in most `:help` files. Since [tables are supported in help](https://github.com/neovim/tree-sitter-vimdoc#tables), it's now possible to render most help files as ["flow" layout](https://github.com/neovim/neovim/blob/9244da12e400ec0291450a5e9400d995e7a29b83/src/gen/gen_help_html.lua#L86-L88) instead of the legacy fixed-width layout. Besides [improved HTML rendering](https://github.com/neovim/neovim/pull/42381#discussion_r4285705739), flow layout will allow `:help` presentation-mode to un-hardwrap text blocks.
* docs: cleanup tables, highlights.scm #42381Justin M. Keyes3 days
| | | highlights.scm: `#match` is slow, prefer `#lua-match`.
* feat(docs): generate PDFJustin M. Keyes4 days
| | | | | Generate PDF using `chrome`. TODO: we probably don't need the `typst` codepath.
* feat(docs): table renderingJustin M. Keyes4 days
| | | | | | Render tables in both `:help` and generated HTML. Use NBSP (nonbreaking space) char in empty table cells.
* fix(docs): listitems with codeblocks #42367Justin M. Keyes4 days
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: - `<` before a listitem (`< - foo`) is not concealed. - Codeblock HTML has extra blank lines. - Codeblock in a listitem ends the listitem, so HTML docs drop the rest of the item and its nesting. Example from `:h nvim_open_win()`: ``` • border: … the double-box style can be specified as: > [ "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" ]. < If fewer than eight chars are given, they will be repeated. • bufpos: … tree-sitter-vimdoc v4.1.0: (block (line_li (prefix) (line) (codeblock (code (line))))) (block (line) ; "If fewer…" (line_li (prefix) (line) (line))) ; "bufpos" tree-sitter-vimdoc v4.2.0: (block (line_li (prefix) (line) (codeblock (code (line))) (line)) ; "If fewer…" (line_li (prefix) (line) (line))) ; "bufpos" ``` Solution: - Bump tree-sitter-vimdoc to v4.2.0. https://github.com/neovim/tree-sitter-vimdoc/pull/174 - gen_help_html: get listitem indent from its first line - gen_help_html: don't double codeblock newlines. - highlight query: conceal `<` in `line_li`. - docs: fix doc sources where a blank line was missing after listitems followed by non-listitem text.
* fix(api): vimscript call to API still requires `opts` param #42146Marc Jakobi2026-09-30
| | | | | | | | | | Problem: API contract was relaxed by 25439dad7e2ba21ff2f78759c68be888a217342c40581 to treat `opts` params as optional. However, when called from Vimscript, omitting the `opts` arg `E119: Not enough arguments for function` error. Solution: Add a min/max argument range in the Vimscript generator if the function has an `opts_idx` field.
* ci(lua): enable annotation and style checksLewis Russell2026-09-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: - annotation-usage-error and code-style-check are disabled. - vim.inspect relies on a dummy self-assignment for docgen, and its help omits parameter and option details. - LuaLS fallback types obscure iterator inference. - Docgen hardcodes public function names and appends separately sorted files, leaving shared helpers under the inspector heading. Solution: - Enable annotation-usage-error and code-style-check, and fix misplaced annotations. - Document vim.inspect's callable module directly, removing the dummy assignment. Describe its parameters, option defaults and process callback. - Remove LuaLS iterator fallbacks, correct iterator signatures and check values that the improved inference identifies as optional. - Parse callable modules, require bindings and parent module references. Derive public names and inherited function docs from these links, including missing help for vim.async.semaphore() and vim.version(). - Export vim.lsp.tagfunc directly with lazy loading and document its implementation instead of maintaining a wrapper. - Group files in section_order, replacing append_only and merge_files. Merge declarations before sorting each section, placing shared helpers in the main vim section and keeping vim.inspect in alphabetical order. - Add basic parser coverage for callable modules and module links. AI-assisted
* fix(api): correct Lua command and completion typesLewis Russell2026-09-28
| | | | | | | | | | | Problem: Command inputs and parsed modifiers have different optional fields, and completion window IDs are annotated as floating-point values. Solution: Separate modifier input and return types, correct integer IDs, and update the metadata generators and their output. AI-assisted
* fix(gen): parse multiline table annotationsLewis Russell2026-09-25
| | | | AI-assisted
* fix(gen): ignore return casts in generated documentationLewis Russell2026-09-25
| | | | | | | | Return-cast annotations refine types but do not add return values. Recognize them before @return and exclude them from rendered docs. Apply narrowing to vim.isnil() without changing its runtime behavior. AI-assisted
* fix(lua): generate explicit overloads for vim.fnLewis Russell2026-09-25
| | | | | | | | | | | | | | | | The generated vim.fn stubs represent overloads as repeated function declarations. EmmyLua merges their return types, so getline(lnum) is inferred as string|string[] even though it always returns a string. Generate one declaration with @overload annotations from the existing __N entries, while keeping separate Vimdoc signatures. Parenthesize the overload return list so types such as (0|-1)[] remain arrays. Correct getline()'s single-line and range signatures, and add typed getqflist() signatures for its entry-list and property-query forms. This lets callers infer quickfix results without local type overrides. AI-assisted
* fix(lint): fix some warnings in clang-tidy 22bfredl2026-09-23
| | | | CI is currently using clang-tidy 21 but prepare for the future
* fix(options): validate nvim_set_option_value() dry runsLewis Russell2026-09-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: nvim_set_option_value() with dry_run=true accepts invalid values such as foldmethod='nonsense'. Validation is mixed with side effects in the did_set_* callbacks, so dry runs skip it. Solution: Split value validation out of the did_set_* callbacks into separate validation_cb callbacks. Use these checks for both normal assignments and nvim_set_option_value() dry runs. Keep side effects in did_set_*. Replace direct foldenable/foldlevel assignments in C folding commands with setters. This gives C commands the same OptionSet and synchronization behavior as Lua assignments. Use normal setters for 'tabstop' and 'vartabstop' in :retab so C code indentation and folds based on indentation use the new tab widths. Direct assignments could leave them using the old widths. :retab temporarily turns off 'list' to calculate tab widths. Previously, :retab -1 reported an error and returned without restoring 'list'. Check the argument before turning 'list' off, so an invalid argument leaves the option unchanged. AI-assisted
* refactor(help): reuse help.lua to generate build tagsLewis Russell2026-09-10
| | | | | | | | | | Make gen_helptags.lua call help.lua instead of keeping its own tag parser. Builds and :helptags now use the same code. Allow the shared code to run without Neovim, and fail the build when tag generation reports an error. AI-assisted
* docs: add help tag for vim.asyncOlivia Kinnear2026-09-09
|
* build: enable more EmmyLua checksLewis Russell2026-09-08
| | | | | | | | | | | | | | | | - call-non-callable - missing-fields - redefined-label - redefined-local - undefined-field - unreachable-code Promote redefined-local and unreachable-code to warnings. Fix DOS line-ending handling for multiline semantic tokens, and support intersection types in the help parser. AI-assisted
* build: replace LuaLS with EmmyLuaLewis Russell2026-09-07
| | | | | | | | | | | | | | | Problem: LuaLS struggles with the generics used in Nvim's runtime, requiring broad diagnostic suppressions. Indexing is also slow. Solution: Use EmmyLua for type checks in the build and CI. It offers more sophisticated type checking, substantially better support for generics, and much better flow analysis. Correct the affected annotations. Use `@internal`, supported directly by EmmyLua, instead of `@nodoc` for shared internal declarations, and support it in the help parser. AI-assisted
* fix(help): resolve generic and nullable type referencesLewis Russell2026-09-07
| | | | | | | | | | Problem: K on generic and nullable type annotations can jump to the wrong help tag. Generated See references repeat the type names. Solution: Strip generic arguments and nullable suffixes when resolving help tags. Remove the redundant generated See references. AI-assisted
* feat(lua): add vim.asyncLewis Russell2026-09-03
| | | | | | | | | | | | | | | | | | | | Problem: Nvim has many Lua APIs that start callback-driven work: timers, jobs, libuv handles, and other event-loop tasks. Callers that need to sequence or cancel that work have to build their own coroutine wrappers, task bookkeeping, and cleanup rules. This makes async control flow hard to share, test, and document. Solution: Add `vim.async`, a structured-concurrency module vendored from async.nvim. It provides task handles, await/pawait helpers, sleep/timeout helpers, completion-order iteration, and semaphores on top of Nvim's event loop. The API follows the same broad model as Trio: async work has an owner, tasks are awaited explicitly, and cancellation is cooperative. Include generated vimdoc with an introductory overview and examples, a news entry, and functional tests for the new module. AI-assisted
* fix(gen_help_html): cleanup #41525Justin M. Keyes2026-08-28
|
* docs(gen_help_html): generate Typst format #40665Kevin2026-08-28
| | | | | | | | Problem: gen_help_html.lua only outputs HTML, but Typst is useful for producing PDFs. Solution: Add gen_one_typ() and ts_node_to_typ(), which mirror the existing gen_one_html() and ts_node_to_html().
* build: don't require the "vimdoc" parser to build NvimJustin M. Keyes2026-08-25
| | | | | | | | | | | | Problem: The runs ":helptags", which needs the tree-sitter-vimdoc parser. This may cause problems for package maintainers / distros? Solution: Use running to generate the tags, like the zig build already does. It also errors on duplicate tags, which is good. The `:helptags` command still uses treesitter.
* fix(help): :helptags regressionsJustin M. Keyes2026-08-25
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Parent commit regressed some behavior of the old C helptags-gen impl: - helpfiles in sub-directories are named by basename, so :help fails - "help-tags" always names "tags", never "tags-nl" - E150 E151 E152 E153 are never reported - existing tags file is not overwritten if no tags were found - a duplicate tag aborts the run, skipping the remaining directories - `*.TXT` and `*.FRX` (uppercase) are not recognized as helpfiles - tree-sitter-vimdoc accepts tags that the C parser rejected: `*a|b*` (breaks |links|) and unterminated `*tag` - PUC Lua "<" compares with (localized) `strcoll()`, so the tags file is not sorted by byte value (E432) - requiring `vim.treesitter` at load time breaks :help itself, not just :helptags, where the module is unavailable - `vim.pack` runs :helptags for plugins that have no "doc/" directory, so every install/update emits E150 Solution: - Fail the build if generating helptags reports any `v:errmsg`. - Restore old behavior: tags generated for runtime/doc are now identical to those from the C implementation. Errors are non-fatal messages instead of exceptions, so all directories are still processed. - Load treesitter lazily, report a plain error if parser is missing.
* 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
* fix(types): emmylua warning about `params` fieldJustin M. Keyes2026-08-04
|
* feat(options): lua closure/function optionsJustin M. Keyes2026-07-31
| | | | | | | | | | | | | | | Problem: Cannot assign Lua functions/closures to "func" ('completefunc', 'tagfun', …) or "expr" ('foldexpr', 'indentexpr', …) options. Solution: - Store "func"/"expr" options as `Callback` instead of string. - Delete oceans of copy-pasted code. - BREAKING: LuaRef returned via RPC/Vimscript is now represented as `"<Lua N: file:line>"` (like what `:map` shows) instead of `nil`. - Note: `man.vim` still uses `v:lua` string, bc it's a vimscript ftplugin. Helped-by: Lewis Russell <lewis6991@gmail.com>
* fix(options): latent codegen bugJustin M. Keyes2026-07-29
| | | | | | | | | | | | | | | Problem: Latent bug from 7f6c14ed54a46e822b80134d39a89f97523a2706 (2015). If an option default is "false" (`o.defaults.if_false = false`, e.g. 'fileignorecase'), codegen does not give it a `.def_val` on the platform where its `#if` condition is undefined; it is zero-initialized. This wasn't noticed until the parent commit, where zero value is kObjectTypeNil, which `set_option_varp()` rejects. Solution: Check `if_false == nil` insteada of "falsey", so the `#else` branch gets generated.
* refactor(options): drop OptVal, use ObjectJustin M. Keyes2026-07-29
| | | | | | | | | | | | | Problem: The object subsystem has an intermediate representation for no real reason. Besides the code cost, this also adds an extra (api <=> OptVal) conversion step, which is a (small) perf cost. Solution: We already have `Object`, so use it instead. - drop `OptVal`, `OptValData`, `OptValType`, and related boilerplate. - add `kObjectTypeUnset`.
* fix(gen): parameter order follows the prototype, not the docsBarrett Ruth2026-07-25
|
* refactor: 'previewpopup' #40945Justin M. Keyes2026-07-24
| | | | - drop w_maxwidth/w_maxheight, calculate them on-demand from 'previewpopup' (this is cheap bc of `opt_keyset`)
* refactor(options): rename, simplifyJustin M. Keyes2026-07-24
|
* perf(options): no-alloc keysetsJustin M. Keyes2026-07-24
|
* refactor(options): store dict options in :set-string formJustin M. Keyes2026-07-24
| | | | | | | | | | The parent commit made a valiant effort to store "dict options" in their reified form, but this is more trouble than it's worth: - inconsistent model for developers to understand. - string lifetime issues (the "varp" convention is to pass around an aliased, long-lived option value). - lots of extra plumbing to deal with the 2 different option-storage paradigms.
* 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.
* fix(docs): multi-level list dedent indentation #40850Maria Solano2026-07-20
| | | | | | | | | | | | | | Problem: The list-item indentation logic in `gen_help_html.lua` tracks `opt.indent` that only decrements by one level when a list item is less indented than its sibling. Dedenting across multiple nesting levels at once produces the wrong left margin. Solution: Track the exact leading whitespace for each indent level in a `opt.indent_ws` stack: - On reset or a top-level item initialize the stack with the current item's whitespace. - When indenting deeper push the current whitespace at the new level. - When dedenting pop every level whose tracked whitespace is deeper than the current item (reaching the correct ancestor level).
* feat(eval): declare more "fast" functions #40834Justin M. Keyes2026-07-19
|
* 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>
* refactor(input): rename getchar.c => input.c #40698Justin M. Keyes2026-07-12
| | | | | | | | | | | | Problem: `getchar.c` is a quirky name and doesn't align with our existing `os/input.c` and `tui/input.c` modules, which encompass the same topic at different layers. Solution: Rename `getchar.c` => `input.c` for discoverability. Introduce `dialog.c` for functionality related to showing confirm prompts, dialogs, etc.
* fix(api): nvim_cmd() "args" type too narrow #40670glepnir2026-07-10
| | | | | | | Problem: nvim_cmd() accepts number/boolean in args and converts them to strings, but the keyset declares ArrayOf(String). Solution: use ArrayOf(Union(Integer, String, Boolean)) and wrap union types in parens when generating array annotations.
* 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(docs): numbered listitemsJustin M. Keyes2026-06-11
|
* feat(startup)!: "standalone" mode -ll is killbfredl2026-06-04
| | | | | | | | | | | | | | This was originally used because we needed a lua interpreter to run the standalone _busted_ lua application (except we used fuckery behind the scenes to fake its binary dependencies with our own binary dependencies). Now we longer do that, we instead run `test.harness` as a standard nvim -l script. as this mode is no longer used in tests it risks going to bitrot anyway. NB: -ll mode still had some theoretical benefits like quicker initialization and more "native" printing behavior, etc. But we can incrementally work on "nvim -l" mode instead of maintaining a separate special thing.
* feat(build.zig): easier cross-complilationbfredl2026-06-04
| | | | invocation of cross-compilation changed, see news.txt blurb
* refactor(build.zig): no need to pass around b.graph.io next to bbfredl2026-06-04
|
* refactor(docs): extract HTML-specific bits from gen_help_html #39946Kevin2026-06-02
| | | | | | | | | | | | | | Pro