aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/help_spec.lua
Commit message (Collapse)AuthorAge
* perf(help): generate helptags with LPegLewis Russell2026-09-10
| | | | | | | | | | | | | | | | Problem: Generating helptags builds and queries a full vimdoc syntax tree. This is much slower than the previous scanner and also happens before discovering that the tags file cannot be written. Solution: Extract tags with an LPeg grammar, reading each file once and skipping example blocks and ordinary text. Open the output first so unwritable directories can return immediately. This restores legacy handling of tags inside inline code spans. On an arm64 Mac, the 5.36 MB runtime corpus takes 24 ms instead of 604 ms, with identical generated tags. 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
* fix(help): :helptags on CRLF helpfilesJustin M. Keyes2026-08-25
| | | | | | | | | | | | | | | | | | | Problem: The vimdoc parser does not treat "\r" as whitespace, so in a CRLF helpfile the codeblock rule fails and "*" pairs inside examples become tags. On Windows this generates duplicate "." and "/" tags: D:/a/neovim/neovim/build/bin/nvim.exe -u NONE -i NONE -e --headless -c "helptags ++t doc" -c "exe 'cquit' !empty(v:errmsg)"" Error in command line: E154: Duplicate tag "." in gui.txt and repeat.txt E154: Duplicate tag "/" in pattern.txt and usr_08.txt E154: Duplicate tag "/" in usr_08.txt and pattern.txt Note: The old C parser was unaffected because it read helpfiles in text mode (`os_fopen(…, "r")`). Solution: Strip "\r" before parsing.
* 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.
* feat(help): generate :helptags using TreesitterYochem van Rosmalen2026-08-25
| | | | | | | | | | | | | | | | | | | | Problem: Tags are manually parsed in C which is not flexible and prone to errors. Extending the help system to allow for other formats (e.g. Markdown) would require a large rewrite in the C core, while with Treesitter it only needs a query update. Solution: Use the power of treesitter to extract the tags from helpfiles. - build: set `$VIMRUNTIME` when generating helptags, like `cmake/Util.cmake` already does for other generators. - fix(help): only accept tags delimited by whitespace. The old C parser only accepted a `*tag*` preceded by start-of-line or whitespace and followed by whitespace or end-of-line. The vimdoc parser also captures tags followed by other text, e.g. `*$XDG_STATE_HOME*/.../logs` in starting.txt, which caused an E154 duplicate tag error for docs that were previously fine.
* fix(help): handle escape edge cases #40901phanium2026-07-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fix(help): preserve multi-letter CTRL modifiers in :help subject Problem: After PR 39537 normalized `CTRL-U-default` by excluding `-` from the trigger char class, the regex `(CTRL%-[^{])([^-_\\])` also fires between `CTRL-S` and the `H` of the `SHIFT` modifier in tags like `c_CTRL-SHIFT-V`, splitting it into the non-existent `c_CTRL-S_HIFT-V`. Solution: Exclude uppercase letters from the char class so a multi-letter modifier following `CTRL-X` (e.g. `SHIFT`, `ALT`) is no longer split. The `-` exclusion from 39537 is preserved so `i_CTRL-U-default` still works. * fix(help): escape ~ in expr-=~? exception to keep regex valid Problem: The `expr-=~?` exception in the tag alias table maps to `=~?`, but in Vim's regex engine `~` refers to the previous substitute pattern. With no prior substitute the pattern fails to compile, so `:help expr-=~?` returns E149 even though the tag exists. Solution: Escape `~` as \\\~` so the alias expands to a valid regex (`=\\\~?`) that substring-matches the `expr-=~?` tag. Other `expr-X?` entries are unaffected since they don't contain `~`. * fix(help): don't insert _ before CTRL- when preceded by - Problem: The rule `([^_])CTRL%- -> %1_CTRL-` inserts an underscore between any non-underscore char and `CTRL-`, which wrongly rewrites tags like `map-CTRL-C` and `telnet-CTRL-]` (where `CTRL-` is literal text in the tag, not a key chord). Solution: Exclude `-` from the trigger char class so a hyphen immediately before `CTRL-` is preserved. The existing behavior for `iCTRL-GCTRL-J` -> `i_CTRL-G_CTRL-J` is unaffected because the `G` before `CTRL-J` is not `-`. * fix(help): only treat ^X as caret notation for valid control chars Problem: The regex `%^([^_])` converts any `^X` to `CTRL-X`, including `:set^=` where `^=` is literal text in the tag, not a caret-notation control character. Solution: Restrict the transformation to caret-notation chars (`%a` or one of `?@[\\]^{}`). This matches the C reference behavior where `^X` is only converted when X is alphanumeric or one of the control-notation punctuation chars. `{` is retained so `^{char}` still maps to the `CTRL-{char}` placeholder tag.
* 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`.
* fix(help): fix CTRL character issue for :help {subject} #39537Yochem van Rosmalen2026-05-01
| | | | | | | | | | | | | Problem: The argument to `:help` is normalized to fit the general tag format. I.e. i^U-default, iCTRL-U-default and i_CTRL_U-default should all point to the i_CTRL_U-default tag. Our normalization adds an underscore around the CTRL keycode, e.g. iCTRL-GCTRL-J becomes i_CTRL-G_CTRL-J. That's not necessary if the following part starts with a dash, like the case of iCTRL-U-default. Solution: Do not insert an underscore if the following character is a dash/minus (-).
* refactor(test): drop deprecated exc_exec #39242Justin M. Keyes2026-04-20
|
* fix(help): show error when using :help! with nothing at cursor #38775zeertzjq2026-04-05
| | | | It's possible to still show the old Easter egg, but then the user won't know about the new feature, so showing E349 is better.
* feat(defaults): map "grx" to vim.lsp.codelens.run() #37689Yi Ming2026-03-19
| | | | | | | | | | Problem Unlike inlay hints, code lenses are closely related to running commands; a significant number of code lenses are used to execute a command (such as running tests). Therefore, it is necessary to provide a default mapping for them. Solution Add a new default mapping "grx" (mnemonic: "eXecute", like "gx").
* fix(ux): drop "Sorry" from messages #38318Justin M. Keyes2026-03-16
| | | | | | | | | Problem: "Sorry" in a message (1) is noise, and (2) actually reduces the clarity of the message because the titlecasing of "Sorry" distracts from the actually important part of the message. Solution: Drop "Sorry" from messages.
* feat(help): super K (":help!") guesses tag at cursor #36205Justin M. Keyes2026-03-15
| | | | | | | | | | | | | Problem: `K` in help files may fail in some noisy text. Example: (`fun(config: vim.lsp.ClientConfig): boolean`) ^cursor Solution: - `:help!` (bang, no args) activates DWIM behavior: tries `<cWORD>`, then trims punctuation until a valid tag is found. - Set `keywordprg=:help!` by default. - Does not affect `CTRL-]`, that is still fully "tags" based.
* refactor(help): move escaping logic to Lua #37757Yochem van Rosmalen2026-02-10
| | | | | | | | | | Problem: Escaping logic for {subject} in ex cmd `:help {subject}` is done in a messy 200+ lines C function which is hard to maintain and improve. Solution: Rewrite in Lua. Use `string.gsub()` instead of looping over characters to improve clarity and add many more tests to be able to confidently improve current code later on.
* 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.
* refactor(test): inject after_each differentlyLewis Russell2024-04-10
|
* test: improve test conventionsdundargoc2024-04-08
| | | | Work on https://github.com/neovim/neovim/issues/27004.
* test: rename (meths, funcs) -> (api, fn)Lewis Russell2024-01-12
|
* test: typing for helpers.methsLewis Russell2024-01-12
|
* fix(remote): make --remote-expr print to stdout (#23980)zeertzjq2023-06-11
|
* fix(helptags): make multibyte help tags work properly (#23975)zeertzjq2023-06-11
|
* tests: use runtime from build for doc/tags with :help (#10479)Daniel Hahler2019-08-28
| | | | | | | | | | | | This is better practice in general, and allows to remove the "helptags ALL" hacks. Ref: https://github.com/neovim/neovim/issues/8824 Ref: https://github.com/neovim/neovim/commit/f1b67c3453c * Makefile: fix dependencies with regard to helptags - use the file as the main target to avoid unnecessary triggering - use "make oldtest" on Travis to ensure it gets built
* help: ignore snapshotted window if invalid (#9774)Marco Hinz2019-03-23
Nvim doesn't expect a window-changing command on an created-window event. autocmd WinNew * wincmd p help help - A snapshot for window 1000 is created. - The window is split and the cursor changes to the new window 1001. - The autocmd kicks in and switches back to 1000. - The help buffer is opened. - On closing the help window 1000, it tries to go back to the snapshotted window which is... 1000. - wp1000->w_buffer == NULL - w_buffer is used by check_cursor() - 🧨 -> 💥 Fixes https://github.com/neovim/neovim/issues/9773