aboutsummaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAge
* feat(treesitter): allow disabling captures and patterns on TSQuery (#32790)Ian Chamberlain2025-03-11
| | | | | | | | | Problem: Cannot disable individual captures and patterns in treesitter queries. Solution: * Expose the corresponding tree-sitter API functions for `TSQuery` object. * Add documentation for `TSQuery`. * Return the pattern ID from `get_captures_at_pos()` (and hence `:Inspect!`).
* fix(lsp): improve LSP floating preview window cleanup #31353glepnir2025-03-11
| | | | | Problem: The current implementation creates a unique autocommand group for each floating preview window, which is inefficient and can lead to numerous autocommand groups. Solution: Use a single shared autocommand group with improved window validation to properly clean up LSP floating preview windows.
* vim-patch:9.1.1193: Unnecessary use of STRCAT() in au_event_disable() (#32829)zeertzjq2025-03-11
| | | | | | | | | | | | | Problem: Unnecessary use of STRCAT() in au_event_disable(). STRCAT() seeks to the end of new_ei, but here the end is already known. Solution: Use STRCPY() and add p_ei_len to new_ei. Also fix a typo in a comment. Add a test that 'eventignore' works in :argdo (zeertzjq). closes: vim/vim#16844 https://github.com/vim/vim/commit/969e11a18b145241dc0ab39fc1be7ed814655dfc Cherry-pick p_ei_len from patch 9.1.0256.
* fix(events): fix incorrect capitalization of Cmdwin* events (#32813)zeertzjq2025-03-11
| | | | | | The name of Cmdwin* events were changed to CmdWin* in 8ed2dbf6e2802516501c11e72e5d6d977e6a07f3 without explanation. This commit changes them back. This doesn't affect the creation or execution of autocommands. It only affects the listing of autocommands.
* vim-patch:9.1.1194: filetype: false positive help filetype detectionzeertzjq2025-03-11
| | | | | | | | | | Problem: filetype: false positive help filetype detection Solution: Only detect a file as help if modeline appears either at start of line or is preceded by whitespace (zeertzjq). closes: vim/vim#16845 https://github.com/vim/vim/commit/6763b0ee95e7e66ab7992653fbba48691e803e70
* vim-patch:9.1.1191: tests: test for patch 9.1.1186 doesn't fail without the ↵zeertzjq2025-03-11
| | | | | | | | | | | patch Problem: Test for patch 9.1.1186 doesn't fail without the patch. Solution: Set 'nomodeline' in the test (zeertzjq). closes: vim/vim#16835 https://github.com/vim/vim/commit/d6c7913e24e07c1d0ea099cda85e0014e8627c5c
* vim-patch:9.1.1186: filetype: help files in git repos are not detectedzeertzjq2025-03-11
| | | | | | | | | | | | | | | | | | | | | | | | Problem: filetype: help files in git repos are not detected Solution: detect */doc/*.txt files as help if they end with a help modeline, even if 'modeline' is off Here's how I checked that this would still detect vim's own help files correctly: $ find . -type f -path '*/doc/*.txt' \ > -exec awk '{ } ENDFILE { print FILENAME ":" $0; }' '{}' + | > grep -v 'vim:.*\<\(ft\|filetype\)=help\>' ./src/libvterm/doc/seqs.txt: 23 DECSM 42 = DECNRCM, national/multinational character closes: vim/vim#16817 https://github.com/vim/vim/commit/16d6fff98ed3a9dfd34a41696b005b0c4c7800f8 Split the pattern into a Lua pattern for the first part and a Vim regex pattern for the second part, so that if the first part doesn't match there is no need to use the Vim regex. Co-authored-by: David Mandelberg <david@mandelberg.org>
* fix(lsp)!: pass buffer number to root_dir functionLewis Russell2025-03-10
| | | | | | | | | | | | | | Problem: The root dir function is not passed any context and can only assume the current buffer is the one being attached. The main use case is for getting the path of the buffer using `nvim_buf_get_name`. Solution: Pass the buffer number as the first argument.
* feat(lsp): support completion context #32793Maria José Solano2025-03-10
| | | | | | | | | Problem: vim.lsp.completion with "autotrigger" enabled, does not send completion context, even though it has all the necessary info. Solution: Include the context for "autotrigger". trigger() also optionally accepts context when manually invoked.
* fix(tohtml): disable modeline #32822altermo2025-03-10
| | | | | | | | Problem: Running :TOhtml with a file containing modeline may generate an invalid modeline in the output. Solution: Add `<!-- vim: set nomodeline: -->` to the output. Use vi-compatible modeline format ("set foo:"), to avoid the trailing `-->` being treated as part of the modeline.
* fix(popup): new preview_bufnr created when menu item is selected #32819glepnir2025-03-10
| | | | | | | | Problem: "use_float" in the if-condition causes a new buffer to be generated on every execution. Solution: - Remove the incorrect use_float check from the condition. - Use buf_clear to properly clear the existing buffer.
* vim-patch:9.1.1190: C indentation does not detect multibyte labels (#32808)zeertzjq2025-03-09
| | | | | | | | | | | Problem: C indentation does not detect multibyte labels Solution: Correctly skip over multibyte characters (Anttoni Erkkilä) closes: vim/vim#16770 https://github.com/vim/vim/commit/f4d87ff8883e5076633ef0ab0cf4d6e4beaddc5c Co-authored-by: Anttoni Erkkilä <anttoni.erkkila@protonmail.com>
* Merge #32687 "g<" for ext_messagesJustin M. Keyes2025-03-09
|\
| * feat(messages): "g<" mapping for ext_messagesLuuk van Baal2025-03-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Cannot use "g<" mapping with ext_messages. Mapping displays the scrollback buffer since the last command, but the scrollback buffer is not populated with ext_messages. Solution: With ext_messages; store messages in the history that otherwise wouldn't be. Mark them as temporary messages to be deleted when the scrollback buffer would be cleared. To this end, make the message history a doubly-linked list such that messages can be removed from an arbitrary position. Outlook: Default ext_messages UI might not show the hit-enter prompt so we want "g<" to work as a recommended way to show messages for the last command (prompted by an indicator).
| * refactor(messages): simplify message historyLuuk van Baal2025-03-03
| |
* | fix(nvim__set_complete): pum preview info truncated during completion #32555glepnir2025-03-09
| | | | | | | | | | | | | | | | | | | | | | Problem: 1. The original info text is truncated in pum_set_preview_text. 2. There is an extra newline character at the end of the info text. 3. Incorrect usage of plines_win leads to errors in calculating the window height. Solution: 1. Improved string handling in pum_preview_set_text to safely process line content without modifying the original text. Now, the preview info is correctly preserved while splitting lines. 2. Do not append a trailing newline to the preview buffer when one is present at the end. 3. Set w_widher_inner in advance; otherwise, plines_win cannot correctly calculate the wrapped line height.
* | vim-patch:9.1.1188: runtime(tera): tera support can be improved (#32799)Muntasir Mahmud2025-03-09
| | | | | | | | | | | | | | | | | | | | Problem: runtime(tera): tera support can be improved Solution: update tera filetype plugin, include a tera syntax script update the filetype test, update makemenu and synmenu vim scripts (MuntasirSZN) closes: vim/vim#16830 vim/vim@14da0fb
* | vim-patch:9.1.1187: matchparen plugin wrong highlights shell case statement ↵zeertzjq2025-03-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#32798) Problem: matchparen plugin wrong highlights shell case statement (Swudu Susuwu) Solution: return early, if we are in a shSnglCase syntax element The shell syntax element "case $var in foobar)" uses closing parenthesis but there is no corresponding opening parenthesis for that syntax element. However matchparen is not aware of such things and will happily try to match just the next opening parenthesis. So let's just add a way to opt out for such cases. In this case, use the syntax state to check if the closing parenthesis belongs to the syntax item "shSnglCase" and if it is, do not try to find a corresponding opening parenthesis. Since inspecting the syntax state might be expensive, put the whole check behind a filetype test, so that matchparen will only perform this particular check, when it knows the current buffer is a "sh" filetype. fixes: vim/vim#16801 closes: vim/vim#16831 https://github.com/vim/vim/commit/9102ac11ab3938ec8c15bfebd00d2f91d3f1cd6c Co-authored-by: Christian Brabandt <cb@256bit.org>
* | refactor(multiqueue): rename multiqueue_new_parent #32767Justin M. Keyes2025-03-08
| |
* | test(lsp/utils): prevent CursorMoved closing float immediately (#32782)zeertzjq2025-03-08
| | | | | | This fixes the flakiness observed in https://github.com/neovim/neovim/actions/runs/13733258040/job/38413757162?pr=32780
* | docs: OSC 133 shell config #32771Justin M. Keyes2025-03-07
| |
* | fix(events): always allow some events to be nested (#32706)zeertzjq2025-03-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Always allow the following four events to be nested, as they may contain important information, and are triggered on the event loop, which may be processed by a blocking call inside another autocommand. - ChanInfo - ChanOpen - TermRequest - TermResponse There are some other events that are triggered on the event loop, but they are mostly triggered by user actions in a UI client, and therefore not very likely to happen during another autocommand, so leave them unchanged for now.
* | test: add benchmark for nvim_replace_termcodes and keytrans()zeertzjq2025-03-08
| |
* | fix(terminal): avoid rescheduling events onto the same queue (#32755)Gregory Anders2025-03-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: When a function like vim.wait() is used, we continuously drain the main event queue until it is empty, never stopping for user input. This means the libuv timer never runs and the terminal never gets refreshed, so emit_termrequest continously reschedules itself onto the same event queue, causing an infinite loop. Solution: Use a separate "pending" event queue, where events that require a terminal refresh are temporarily placed. Drain this queue after a terminal refresh and events are copied back onto the main queue. This prevents infinite loops since the main event queue will always be able to properly drain.
* | fix(marks): mark winline as invalid if change is in a concealed line (#32766)luukvbaal2025-03-07
| | | | | | | | Code that checks whether a `w_lines` entry has become invalid due to a change in a folded line should now also check for concealed lines.
* | feat(defaults): jump between :terminal shell prompts with ]]/[[ #32736Gregory Anders2025-03-07
| |
* | fix(lua): always use vim.inspect() for :lua= (#32715)zeertzjq2025-03-07
| |
* | vim-patch:9.1.1177: filetype: tera files not detectedChristian Clason2025-03-07
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: filetype: tera files not detected Solution: detect '*.tera' files as tera filetype, include a simple filetype plugin (MuntasirSZN) closes: vim/vim#16806 https://github.com/vim/vim/commit/5daaf2326800ff0683a5be9a7f475667a4fc09db Co-authored-by: MuntasirSZN <muntasir.joypurhat@gmail.com>
* | fix(marks): wrong winline info for concealed line with below virt line (#32747)luukvbaal2025-03-06
| | | | | | | | | | | | | | Problem: Skipping over a concealed line for which `win_line()` _should_ be called because it has `virt_lines_above = false` lines associated with it. Solution: Don't include such a line in `wl_lastlnum` from the line above.
* | vim-patch:9.1.1173: filetype: ABNF files are not detected (#32751)zeertzjq2025-03-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: filetype: ABNF files are not detected Solution: detect '.abnf' file as abnf filetype and include an abnf syntax plugin (A4-Tacks). References: - RFC5234 - RFC7405 closes: vim/vim#16802 https://github.com/vim/vim/commit/9f827ec58728c4ea55a8d71d40a283ca2ce5b058 Co-authored-by: A4-Tacks <wdsjxhno1001@163.com>
* | fix(terminal): improve cursor refresh handling (#32596)Sean Dewar2025-03-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: terminal mode cursor refresh logic has too many edge cases where it fails when events change curbuf. Solution: change the logic. Introduce cursor_visible to TerminalState to more reliably track if terminal mode has changed busy. Move visibility handling to refresh_cursor and move its call in refresh_terminal to terminal_check to avoid temporarily changed curbufs from influencing cursor state. This has the effect of "debouncing" shape/visibility updates to once per terminal state tick (with the final attributes taking effect, as expected). I think this is OK, but as a result it may also be warranted to update when redrawing during the same state tick (e.g: from events executing :redraw); this can be added later, if wanted. Also move previous tests to a more appropriate place.
* | feat(lsp): support for resolving code action command (#32704)Maria José Solano2025-03-06
| | | | | | | | | | * fix(lsp): don't call codeAction_resolve with commands * feat(lsp): support for resolving code action command
* | vim-patch:9.1.1176: wrong indent when expanding multiple lines (#32746)zeertzjq2025-03-06
| | | | | | | | | | | | | | | | | | | | Problem: wrong indentation of lastline when expanding multiple lines Solution: Check OPENLINE_FORCE_INDENT flag in open_line() (glepnir) closes: vim/vim#16786 https://github.com/vim/vim/commit/34a7d82aaed9836174f4ea84af047db3fdf6c8b3 Co-authored-by: glepnir <glephunter@gmail.com>
* | vim-patch:9.1.1175: inconsistent behaviour with exclusive selection and ↵zeertzjq2025-03-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | motion commands (#32745) Problem: inconsistent behaviour with exclusive selection and motion commands (aidancz) Solution: adjust cursor position when selection is exclusive (Jim Zhou) fixes: vim/vim#16278 closes: vim/vim#16784 https://github.com/vim/vim/commit/c8cce711dde2d8abcf0929b3b12c4bfc5547a89d Co-authored-by: Jim Zhou <jimzhouzzy@gmail.com> Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
* | vim-patch:9.1.1174: tests: Test_complete_cmdline() may fail (#32743)zeertzjq2025-03-05
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: tests: when the file 'TestCommand?Test' exists, 'Test_complete_cmdline()' will fail when writing the file. And there's no related cleaning operation for this kind of file before the test run. Solution: modify `write` to `write!` to override (Jim Zhou). closes: vim/vim#16799 https://github.com/vim/vim/commit/f7087cbec7ec1d32465c2460f2665725c8d3a06a Co-authored-by: Jim Zhou <jimzhouzzy@gmail.com>
* | vim-patch:9.1.1172: [security]: overflow with 'nostartofline' and Ex command ↵zeertzjq2025-03-06
| | | | | | | | | | | | | | | | | | | | | | in tag file (#32739) Problem: heap-buffer-overflow with 'nostartofline' and Ex command in tag file. Solution: Set cursor column when moving cursor to line 1 (zeertzjq). closes: vim/vim#16796 https://github.com/vim/vim/commit/3ed6659549e447ff00def8edc841321e497f70a8
* | feat(terminal)!: include cursor position in TermRequest event data (#31609)Gregory Anders2025-03-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a plugin registers a TermRequest handler there is currently no way for the handler to know where the terminal's cursor position was when the sequence was received. This is often useful information, e.g. for OSC 133 sequences which are used to annotate shell prompts. Modify the event data for the TermRequest autocommand to be a table instead of just a string. The "sequence" field of the table contains the sequence string and the "cursor" field contains the cursor position when the sequence was received. To maintain consistency between TermRequest and TermResponse (and to future proof the latter), TermResponse's event data is also updated to be a table with a "sequence" field. BREAKING CHANGE: event data for TermRequest and TermResponse is now a table
* | fix(lua): format errors from luv callbacks using __tostringbfredl2025-03-05
| |
* | vim-patch:9.1.1170: wildmenu highlighting in popup can be improved (#32728)zeertzjq2025-03-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: wildmenu highlighting in popup can be improved Solution: Check if the completion items contain submatches of the entered text (Girish Palya). This update enables highlighting in the popup menu even when the matched fragment or pattern appears within an item (string) rather than only at the beginning. This is especially useful for custom completion, where menu items may not always start with the typed pattern. For specific use cases, refer to the two examples in https://github.com/vim/vim/pull/16759 A sliding window approach is used with direct string comparison. Performance is not a concern, as highlighting is applied only to displayed lines, even if the menu list is arbitrarily long. closes: vim/vim#16785 https://github.com/vim/vim/commit/4ec46f32102e5569b247840e05a99221747a9381 Co-authored-by: Girish Palya <girishji@gmail.com>
* | vim-patch:9.1.1171: tests: wrong arguments passed to assert_equal() (#32727)zeertzjq2025-03-05
| | | | | | | | | | | | | | | | | | Problem: tests: wrong arguments passed to assert_equal() (after v9.1.1167). Solution: Swap arguments in the assert_equal() call (zeertzjq). closes: vim/vim#16782 https://github.com/vim/vim/commit/a95085e0fc2e46c7136982e8ba1ae91375991bfd
* | fix(display): adjust winline info for concealed lines below last line (#32708)luukvbaal2025-03-04
| | | | | | | | | | | | | | Problem: Last line in a window does not store correct `wl_lastlnum` if lines below it are concealed (resulting in e.g. incorrect cursor row). Solution: Increment `wl_lastlnum` while it points to a line above a concealed line.
* | fix(lsp): open_floating_preview() ignores max_height (#32716)Robert Muir2025-03-04
| | | | | | | | | | | | | | Problem: After 47aaddfa the max_height option is no longer respected. Hover documentation and Signature help windows take up the entire text height. Solution: Compare to window's current height and only modify the height if it would reduce the height, not enlarge it.
* | fix(diagnostic): virtual_lines diagnostic columns (#32703)James Trew2025-03-04
| | | | | | | | | | When multiple diagnostics appear on a single line, the virtual lines for all diagnostics except the first were rendered with progressively fewer columns.
* | refactor(tests): use new-style highlight spec in legacy/bfredl2025-03-04
| |
* | vim-patch:9.1.1167: mark '] wrong after copying text object (#32712)zeertzjq2025-03-04
| | | | | | | | | | | | | | | | | | | | | | | | Problem: mark '] wrong after copying text object (ubaldot) Solution: Adjust position of '] for non-linewise, exclusive motions (Jim Zhou) related: vim/vim#16679 closes: vim/vim#16772 https://github.com/vim/vim/commit/360a39ae6c823dd3e3c89c209b544f345c6d86dd Co-authored-by: Jim Zhou <jimzhouzzy@gmail.com>
* | vim-patch:9.1.1166: command-line auto-completion hard with wildmenuTomas Slusny2025-03-04
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: command-line auto-completion hard with wildmenu Solution: implement "noselect" wildoption value (Girish Palya) When `noselect` is present in `wildmode` and 'wildmenu' is enabled, the completion menu appears without pre-selecting the first item. This change makes it easier to implement command-line auto-completion, where the menu dynamically appears as characters are typed, and `<Tab>` can be used to manually select an item. This can be achieved by leveraging the `CmdlineChanged` event to insert `wildchar(m)`, triggering completion menu. Without this change, auto-completion using the 'wildmenu' mechanism is not feasible, as it automatically inserts the first match, preventing dynamic selection. The following Vimscript snippet demonstrates how to configure auto-completion using `noselect`: ```vim vim9script set wim=noselect:lastused,full wop=pum wcm=<C-@> wmnu autocmd CmdlineChanged : timer_start(0, function(CmdComplete, [getcmdline()])) def CmdComplete(cur_cmdline: string, timer: number) var [cmdline, curpos] = [getcmdline(), getcmdpos()] if cur_cmdline ==# cmdline # Avoid completing each character in keymaps and pasted text && !pumvisible() && curpos == cmdline->len() + 1 if cmdline[curpos - 2] =~ '[\w*/:]' # Reduce noise by completing only selected characters feedkeys("\<C-@>", "ti") set eventignore+=CmdlineChanged # Suppress redundant completion attempts timer_start(0, (_) => { getcmdline()->substitute('\%x00$', '', '')->setcmdline() # Remove <C-@> if no completion items exist set eventignore-=CmdlineChanged }) endif endif enddef ``` fixes: vim/vim#16551 closes: vim/vim#16759 https://github.com/vim/vim/commit/2bacc3e5fb3569e0fd98e129cb1e422ca18b80a6 Cherry-pick Wildmode_Tests() change from patch 9.0.0418. Co-authored-by: Girish Palya <girishji@gmail.com> Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
* vim-patch:9.1.1165: diff: regression with multi-file diff blocks (#32702)zeertzjq2025-03-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Vim's diff block merging algorithm when doing a multi-file diff is buggy when two different diff hunks overlap a single existing diff block (after v9.1.0743) Solution: fix a couple bugs in this logic: 1. Fix regression from v9.1.0743 where it's not correctly expanding the 2nd overlap correctly, where it always expands without taking into account that this was always taken care of when the first overlap happened. Instead, we should only grow the 2nd overlap if it overhangs outside the existing diff block, and if we encounter a new overlapping diff block (due to overlap chaining). 2. When we expand a diff block to match the hunk size on the orig side (when handling the first overlap), we expand the same amount of lines in the new side. This is not sound if there exists a second overlap hunk that we haven't processed yet, and that hunk has different number of lines in orig/new. Fix this by doing the corresponding counter adjustment when handling 2nd/3rd/etc overlap by calculating the difference in lines between orig and new side. (Yee Cheng Chin) closes: vim/vim#16768 https://github.com/vim/vim/commit/bc08ceb75572dcac57ef5019f3d0df6e8290c0f9 Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
* docs: misc #31996Justin M. Keyes2025-03-02
|
* feat(lua): don't complete private (_) fields after dot (.) #32690Maria José Solano2025-03-02
|
* feat(comment): allow commentstring to be determined from node metadataRiley Bruins2025-03-02
| | | | | | | | | | | **Problem:** Some weird languages have different comment syntax depending on the location in the code, and we do not have a way to determine the correct `commentstring` for these special cases. **Solution:** Allow queries to specify `commentstring` values in metadata, allowing users/`nvim-treesitter` to provide a better commenting experience without hugely increasing the scope of the code in core.