aboutsummaryrefslogtreecommitdiff
path: root/test/functional/editor/completion_spec.lua
Commit message (Collapse)AuthorAge
* vim-patch:9.2.1067: Completion shows an included file by full path (#41849)zeertzjq2026-09-11
| | | | | | | | | | | | | | | Problem: A match found in an included file is shown with the full path of the file, while a match from a buffer is shown with the name under the current directory. A file included as "./file" even has the "./" left in: "dir/./file". Solution: Show the file by its name under the current directory, and simplify the name of a file found relative to the current one (Hirohito Higashi). closes: vim/vim#21264 https://github.com/vim/vim/commit/cff83f361de471456d98b070ec3e63b0e5e6f17c Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
* fix(cwd): :bcd completion shows non-directories #41661li2026-09-05
| | | | | | | Problem: Completion for `:bcd` shows files, not just directories. Solution: Set the ctx properly.
* vim-patch:9.2.1009: duplicate dict code in ins_compl_dict_alloc() (#41497)glepnir2026-08-26
| | | | | | | | | Problem: ins_compl_dict_alloc() builds the same dict as fill_complete_info_dict(). Solution: Call fill_complete_info_dict() instead (glepnir). closes: vim/vim#21140 https://github.com/vim/vim/commit/303a153694d93e93620023835c64e4dc2122e3b2
* fix(ruler)!: consistent width in last line and statuslineSébastien Hoffmann2026-08-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Traditionally, the ruler in the last line is one cell shorter than in the statusline, leaving the last cell of the screen blank. According to code comments, this is in order to prevent unwanted scrolling on "some" (unspecified, but presumably ancient) terminals. Berkeley vi is more specific in its `vs_modeline` function: dumb terminals with hardware scroll, SunOS 4.1.1 and Ultrix 4.2 curses. (n)curses still has a similar limitation in `(w)addstr`, but apparently only for historical reasons. Maintaining the different widths leads to awkward inconsistencies when the ruler is configured with 'rulerformat', except for the special case where it contains a top-level `%=`. Shifting the ruler in the last line to the left would be a solution, but the empty cell at the end doesn't seem to be relevant anymore. Solution: extend the ruler in the last line all the way to the right edge of the screen, just like in the statusline. The exact same amount of place will be available to the rest of the UI as before. BREAKING CHANGE: - the default ruler width is now 18 cells - the last cell of the screen is no longer empty Closes #41076
* fix(eval): complete_info() equal, preselect, commit_chars #41022glepnir2026-07-28
| | | | | Problem: complete_info() does not report "equal", "preselect" or "commit_chars". Solution: Report them for the items that set them.
* fix(completion): "preselect" ignores "noinsert", menu order #41007glepnir2026-07-27
| | | | | | | Problem: A preselected item is inserted even with "noinsert", and the first added preselected item wins over the first one shown in the menu. Solution: Use K_DOWN when "noinsert" is set; pick the first preselected item that made it into the menu.
* 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(completion): commitCharacters #38417glepnir2026-07-15
| | | | | | | | | Problem: LSP completion commitCharacters are not handled. Typing a commit character (e.g. `.`, `(`, `;`) while a completion item is selected does not accept the item first. Solution: Store commit characters as a flat string in complete-items. Check it before completion stops, accept the match and let the character be inserted normally.
* fix(path): normalize separators (slashes) #39155tao2026-07-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Continue separators normalization, and try to keep it at the nvim <-> external boundary, e.g., `fn.xxx`, `api.xxx`, `:xxx` Solution: some key changes - normalize `$HOME-windows` - normalize entry points of changing directory - `nvim_set_current_dir()`, `chdir()` - normalize the named pipe - `--listen` arg, `--server` arg, `:restart` - `serverstart()`, `sockconnect()`, `serverstop()` - make `expand()` respect 'shellslash' again - clean up `did_set_shellslash` - replace `forward_slash` with `TO_SLASH` - remove obsolete `TMP_PATHSEPSTR` - remove `slash_adjust` in `do_autocmd_dirchanged`? - make `fnamemodify()` always return `/` (except when substituting separators via `:s`, `:gs` ?) Note: - these funcs still apply `slash_adjust` on return, as before: `:pwd`, `chdir()`, `exepath()`, `getcwd()` - these funcs alwarys return `/`, unlike before the normalization PRs - `getcompletion()`, `finddir()`, `findfile()` Also - clean up code, comments, formatting and tests - move `TO_SLASH` from `f_chdir` to `changedir_func` - move `TO_SLASH` from `f_bufadd` to `buflist_new` Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* vim-patch:9.2.0759: Some code for 'autocompletedelay' is no longer neededzeertzjq2026-07-02
| | | | | | | | | | | Problem: Some code for 'autocompletedelay' is no longer needed now that 'autocompletedelay' doesn't block redraw (after 9.2.0739). Solution: Remove unnecessary code. Also remove a duplicate screendump and an outdated comment in test (zeertzjq) closes: vim/vim#20686 https://github.com/vim/vim/commit/0b86b97cc9de013483875d0fab14d9040bcbe279
* vim-patch:9.2.0749: 'autocompletedelay' interferes with i_CTRL-Kzeertzjq2026-07-02
| | | | | | | | | | Problem: 'autocompletedelay' interferes with i_CTRL-K (after 9.2.0739). Solution: Clear the pending autocompltion from the previous key when a new key is typed. closes: vim/vim#20666 https://github.com/vim/vim/commit/0d292e20676cb399fa6bee8300d7ae3bebe97a8f
* vim-patch:9.2.0739: completion: 'autocompletedelay' blocks the main loop and ↵zeertzjq2026-07-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | drops autocommands Problem: With a non-zero 'autocompletedelay', Insert-mode autocommands (TextChangedI, TextChangedP, CursorMovedI) are delayed, and while typing faster than the delay they are dropped entirely, because the delay blocks the main loop. Solution: Make 'autocompletedelay' non-blocking: instead of busy-waiting before showing the popup menu, defer it with an input-wait timeout (K_COMPLETE_DELAY) modeled on CursorHoldI, so typing stays responsive and the Insert-mode autocommands fire normally. The delay timer coexists with 'updatetime': the main loop waits for the sooner of the two and triggers the event whose deadline was reached, so 'autocompletedelay' no longer shadows CursorHold timing. Changing the completion leader, for example with Backspace, updates the visible popup immediately like a zero delay; only the first popup is deferred. Update the 'autocompletedelay' screendumps for the non-blocking display. One test opened the menu with CTRL-N right after the delay expired and could race with the deferred popup, so it now waits a little longer than the delay before sending the key. fixes: vim/vim#20591 closes: vim/vim#20598 https://github.com/vim/vim/commit/8ce43ea4e3cb315f566bcd9048c254ba58042964 Also include some insexpand.c and ui.c changes from patch 9.2.0750. Co-authored-by: Hirohito Higashi <h.east.727@gmail.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(cmdwin): space in cmdwin-char 'statuscolumn'Justin M. Keyes2026-06-26
| | | | | To match the old behavior, the cmdwin-char should not be followed by a space char.
* fix(cmdwin): duplicate line in historyJustin M. Keyes2026-06-26
| | | | | | | | | Problem: After ctrl-f from the cmdline, the last 2 lines of cmdwin are redundant. Solution: In `open_cmdwin`, clear the live cmdline so that unwinding it (via Ctrl_C) does not add it to history.
* 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).
* refactor(test): drop deprecated exc_exec #39242Justin M. Keyes2026-04-20
|
* docs: lsp, options, api #38980Justin M. Keyes2026-04-14
| | | | | | | | | docs: lsp, options - revert bogus change to `_meta/builtin_types.lua` from 3a4a66017b74 Close #38991 Co-authored-by: David Mejorado <david.mejorado@gmail.com>
* fix(completion): preselect ignores completeopt flag #39030glepnir2026-04-14
| | | | | | | Problem: compl_preselect_match is set even when completeopt doesn't include preselect. Solution: Check kOptCotFlagPreselect in ins_compl_add before setting compl_preselect_match.
* feat(completion): completeopt=preselect, LSP CompletionItem.preselect #36613glepnir2026-04-13
| | | | | | | | | | Problem: LSP CompletionItem.preselect is not supported. https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionClientCapabilities Solution: - Add "preselect" field to complete-items and "preselect" flag to 'completeopt'. - Set preselectSupport=true in LSP client capabilities.
* fix(tui): log chdir failure properly #37591zeertzjq2026-01-28
|
* vim-patch:9.1.2064: completion: segfault during file name completion (#37316)zeertzjq2026-01-09
| | | | | | | | | | Problem: completion: segfault during file name completion Solution: Initialize compl_num_bests (Girish Palya) closes: vim/vim#19134 https://github.com/vim/vim/commit/4895ae8c0cd144c98cfb05e0162c2caac8f63c4c Co-authored-by: Girish Palya <girishji@gmail.com>
* fix(completion): complete drive-letter filepath on Windows #3635311soda112025-10-31
| | | | | | | | | | | | | | | | | Problem: On MSWIN, file completion (CTRL-X CTRL-F) only works for the current drive (so not for actual absolute paths), since drive letters are never included in the completion pattern. e.g. when completing "F:\Hello" Nvim currently completes "\Hello" which is relative to the current drive/volume. vim solves this by adding ':' to the default 'isfname' value on mswin, but that causes issues as ':' is not a valid windows path char anywhere _except_ after the drive letter. Solution: detect drive letters in front of the path when creating the completion pattern.
* vim-patch:9.1.1820: completion: some issues with 'acl' (#36007)zeertzjq2025-10-03
| | | | | | | | | | | | | | | | | | | | | Problem: completion: some issues with 'acl' when "preinsert" and "longest" is in 'completeopt' (musonius, after v9.1.1638) Solution: Fix various issues (see details below) (Girish Palya) This commit addresses multiple issues in the 'autocompletedelay' behavior with "preinsert" and "longest": - Prevents spurious characters from being inserted. - Ensures the completion menu is not shown until `autocompletedelay` has expired. - Shows the "preinsert" effect immediately. - Keeps the "preinsert" effect visible even when a character is deleted. fixes: vim/vim#18443 closes: vim/vim#18460 https://github.com/vim/vim/commit/f77c187277c3fd2af7a48f8b15093a3e40ca95a0 Co-authored-by: Girish Palya <girishji@gmail.com>
* vim-patch:9.1.1800: completion: strange behaviour with 'ac' ↵zeertzjq2025-09-30
| | | | | | | | | | | | | | | completeopt=longest,preinsert Problem: completion: strange behaviour with 'ac' completeopt=longest,preinsert (zeertzjq) Solution: Let preinsert take precedence (Girish Palya) fixes: vim/vim#18410 closes: vim/vim#18428 https://github.com/vim/vim/commit/d35e5e4237ec578962d3d577bc5a4e4f6bf4abb2 Co-authored-by: Girish Palya <girishji@gmail.com>
* vim-patch:9.1.1797: completion: autocompletion can be improvedzeertzjq2025-09-30
| | | | | | | | | | | | | | | | | | | | | Problem: completion: autocompletion can be improved Solution: Add support for "longest" and "preinsert" in 'autocomplete'; add preinserted() (Girish Palya) * Add support for "longest" in 'completeopt' when 'autocomplete' is enabled. (Note: the cursor position does not change automatically when 'autocomplete' is enabled.) * Add support for "preinsert" when 'autocomplete' is enabled. Ensure "preinsert" works the same with and without 'autocomplete' * introduce the preinserted() Vim script function, useful for defining custom key mappings. fixes: vim/vim#18314 closes: vim/vim#18387 https://github.com/vim/vim/commit/c05335082adb21d99d96374779856444a3a0688f Co-authored-by: Girish Palya <girishji@gmail.com>
* test: fix 'autocompletedelay' test flakiness (#35856)zeertzjq2025-09-21
|
* vim-patch:9.1.1779: completion: 'autocomplete' cannot be enabled per buffer ↵zeertzjq2025-09-21
| | | | | | | | | | | | | | (#35853) Problem: completion: 'autocomplete' cannot be enabled per buffer (Tomasz N) Solution: Make 'autocomplete' global or local to buffer (Girish Palya) fixes: vim/vim#18320 closes: vim/vim#18333 https://github.com/vim/vim/commit/0208b3e80a080740ff77a5661d0f65090e317d90 Co-authored-by: Girish Palya <girishji@gmail.com>
* vim-patch:9.1.1772: completion: inconsistent selection of first item with ↵zeertzjq2025-09-19
| | | | | | | | | | | | | | | 'autocomplete' (#35835) Problem: completion: inconsistent selection of first item with 'autocomplete' (Tomasz N) Solution: Check for 'autocomplete' option in ins_compl_new_leader() (Girish Palya). fixes: vim/vim#18326 closes: vim/vim#18329 https://github.com/vim/vim/commit/86e8e909f2e8cc1f851b4b62c3060c86c1afae65 Co-authored-by: Girish Palya <girishji@gmail.com>
* vim-patch:9.1.1750: completion: preinserted text highlighed using ComplMatchInszeertzjq2025-09-11
| | | | | | | | | | | | | | | | | | Problem: completion: preinserted text highlighed using ComplMatchIns Solution: Use highlighting group PreInsert and update the documentation (Girish Palya). When "preinsert" is included in 'completeopt', only the PreInsert highlight group should be applied, whether autocompletion is active or not. Previously, ComplMatchIns was used when autocompletion was not enabled. Related to https://github.com/vim/vim/pull/18213. closes: vim/vim#18254 https://github.com/vim/vim/commit/2525c56e423b3ddce8de925f582b9c4d00079675 Co-authored-by: Girish Palya <girishji@gmail.com>
* test: increase timeout in 'autocompletedelay' test (#35467)zeertzjq2025-08-25
| | | | Change timeout from 200ms to 400ms, which is still 100ms lower than the 'autocompletedelay' value.
* vim-patch:9.1.1681: tests: no test for actually moving cursor with 'acl' ↵zeertzjq2025-08-24
| | | | | | | | | | | | (#35452) Problem: tests: no test for actually moving cursor when menu is not open with 'autocompletedelay'. Solution: Use <Up> first in the test. Also remove two unnecessary <Esc>s in completion timeout test (zeertzjq). closes: vim/vim#18097 https://github.com/vim/vim/commit/e8b99ff6d58b69639c29756edbfc655af38f9f03
* vim-patch:9.1.1657: Autocompletion adds delayzeertzjq2025-08-23
| | | | | | | | | | | | | | Problem: Autocompletion adds delay (gcanat, char101, after v9.1.1638) Solution: Temporarily disable autocomplation (Girish Palya). related: vim/vim#17960 fixes: vim/vim#18022 closes: vim/vim#18048 https://github.com/vim/vim/commit/196c376682f9ebad0d13a8d5458accfb33372537 Co-authored-by: Girish Palya <girishji@gmail.com>
* vim-patch:9.1.1638: completion: not possible to delay the autcompletionzeertzjq2025-08-23
| | | | | | | | | | | | | | | | | | | | | | | | | Problem: completion: not possible to delay the autcompletion Solution: add the 'autocompletedelay' option value (Girish Palya). This patch introduces a new global option 'autocompletedelay'/'acl' that specifies the delay, in milliseconds, before the autocomplete menu appears after typing. When set to a non-zero value, Vim waits for the specified time before showing the completion popup, allowing users to reduce distraction from rapid suggestion pop-ups or to fine-tune the responsiveness of completion. The default value is 0, which preserves the current immediate-popup behavior. closes: vim/vim#17960 https://github.com/vim/vim/commit/a09b1604d4fe7516d87fbcbf2ffd2dc484799b23 N/A patch: vim-patch:9.1.1641: a few compiler warnings are output Co-authored-by: Girish Palya <girishji@gmail.com>
* fix(cmdline): completion for command after :restart (#35256)zeertzjq2025-08-09
|
* vim-patch:9.1.1563: completion: ruler may disappear (#34977)zeertzjq2025-07-17
| | | | | | | | | | | | | | | | | | | | | Problem: The ruler disappears after typing the second character during insert mode completion, even when completion messages are suppressed ('shortmess' includes "c"). This makes the UI appear inconsistent. Solution: Ensure the ruler is restored during screen redraw when popup completion is active (Girish Palya). Notes: No new tests were added, as existing screen dump tests were updated to reflect the corrected behavior. closes: vim/vim#17770 https://github.com/vim/vim/commit/824286c9a727811ed93e4e2f4f10944f735436e7 Nvim already behaves correctly as the popup menu is a separate grid in the compositor. Co-authored-by: Girish Palya <girishji@gmail.com>
* vim-patch:9.1.1539: completion: messages don't respect 'shm' setting (#34923)zeertzjq2025-07-13
| | | | | | | | | | | | | | | | | | | | | | Problem: completion: messages don't respect 'shm' setting Solution: Turn off completion messages when 'shortmess' includes "c" (Girish Palya). `:set shortmess+=c` is intended to reduce noise during completion by suppressing messages. Previously, some completion messages still appeared regardless of this setting. This change ensures that **all** completion-related messages are suppressed when `'c'` is present in `'shortmess'`. Not entirely sure if the original behavior was intentional. If there's a reason certain messages were always shown, feel free to close this without merging. closes: vim/vim#17737 https://github.com/vim/vim/commit/fe1d3c8af764831aa51a8922ce24a7cfd9e6129d Co-authored-by: Girish Palya <girishji@gmail.com>
* vim-patch:9.1.1408: not easily possible to complete from register content ↵glepnir2025-05-28
| | | | | | | | | | | (#34198) Problem: not easily possible to complete from register content Solution: add register-completion submode using i_CTRL-X_CTRL-R (glepnir) closes: vim/vim#17354 https://github.com/vim/vim/commit/0546068aaef2b1a40faa2945ef7eba249739f219
* fix(ui): exclude unfocusable windows from 'complete' "w" completionLuuk van Baal2025-04-25
| | | | | | | Problem: As in f85bc41, assume unfocusable windows to be UI windows whose buffer content is unexpectedly included in 'complete' "w" completion. Solution: Exclude unfocusable windows when looping over windows.
* fix(cmdline): cmdline completion of _defer_require() modules #33007phanium2025-03-24
| | | | | | | | | | | Problem: `:lua vim.lsp.c<tab>` does not list vim.lsp.completion in the completion list after 24cea4c7f7417c7fe99a98a0487f51dd68c4f409. Solution: - Always include `vim.lsp._submodule` keys in candidates. - Fixes `vim.lsp.c<tab>` -> `vim.lsp.completion`. - Eager-load `vim.lsp.completion` to get its completion. - Fixes `vim.lsp.completion.g<tab>` -> `vim.lsp.completion.get`.
* refactor(test): deprecate n.feed_command() #32915Justin M. Keyes2025-03-15
| | | | | | | | | | | Problem: `feed_command()` was added as a "bridge" for old test code. 99% of those cases should be using `n.command()`, which raises errors instead of silently continuing the test. Solution: Deprecate `feed_command()`. It should not be used in new tests. All usages of `feed_command()` should be converted to `command()` or `feed()`.
* test(completion_spec): make Enter test descriptions more accuratezeertzjq2025-02-21
|
* vim-patch:9.1.1121: Enter does not insert newline with "noselect"glepnir2025-02-21
| | | | | | | | | | | | | | | Problem: Enter does not insert newline with "noselect" when the pum is visible (lifepillar) Solution: When Enter is pressed and no complete-item is selected, ins_compl_prep returns false, and the edit function continues processing Enter to insert a new line. (glepnir) fixes: vim/vim#1653 closes: vim/vim#16653 https://github.com/vim/vim/commit/07f0dbe3aa326fdf4d0f1b1cf7d79df89e91fc6e Co-authored-by: glepnir <glephunter@gmail.com>
* fix(api): nvim__complete_set requires completeopt=popup #31177glepnir2025-01-05
| | | | | | | | Problem: If completeopt does not include "popup" flag, nvim__complete_set still auto-creates a floating preview window. Solution: Fail if completeopt does not include the "popup" flag.
* fix(completion): avoid deleting text when completion leader changes #31448luukvbaal2024-12-06
| | | | | | | Problem: When completion leader changes, text that might be reinserted immediately after is deleted. This unnecessarily affects extmarks. #31387 restored the original extmarks but that prevents end_right_gravity marks from growing. Solution: Avoid deleting leader text that will be reinserted.
* docs: graduate intro.txt to "flow layout" #31462Justin M. Keyes2024-12-05
| | | - move credits and backers to credits.txt
* fix(extmark): builtin completion can still affect nearby extmarks #31387luukvbaal2024-12-02
| | | | | | | Problem: Built-in completion can still affect nearby extmarks. #31384 Solution: Restore extmarks when completion leader changes.
* fix(tests): needing two calls to setup a screen is cringebfredl2024-11-14