Commit Graph
8413 Commits
Author SHA1 Message Date
Robert Muir 7d5866d471 fix(lsp): open_floating_preview() ignores max_height (#32716)
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.
2025-03-04 18:36:57 +00:00
James Trew fb842dfc22 fix(diagnostic): virtual_lines diagnostic columns (#32703)
When multiple diagnostics appear on a single line, the virtual lines for
all diagnostics except the first were rendered with progressively fewer
columns.
2025-03-04 08:59:37 -06:00
zeertzjq 65a3da8b15 vim-patch:659cb28: runtime(doc): fix typo "bet" in :h 'completeopt' (#32711)
closes: vim/vim#16773

https://github.com/vim/vim/commit/659cb28c25b756e59c712c337f8b4650e85f8bcd
2025-03-04 07:04:25 +08:00
Tomas SlusnyandGirish Palya 99d688e645 vim-patch:9.1.1166: command-line auto-completion hard with wildmenu
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>
2025-03-04 06:20:20 +08:00
zeertzjqandChristian Brabandt 560b8a8ce0 vim-patch:9.1.1164: [security]: code execution with tar.vim and special crafted tar files (#32701)
Problem:  editing a special crafted tar file allows code execution
          (RyotaK, after 129a8446d23cd9cb4445fcfea259cba5e0487d29)
Solution: escape the filename before feeding it to the `:read` command

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-wfmf-8626-q3r3

https://github.com/vim/vim/commit/334a13bff78aa0ad206bc436885f63e3a0bab399

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-03-02 22:59:54 +00:00
Justin M. Keyes c4a0c1d3b0 docs: misc #31996 2025-03-02 14:27:52 -08:00
Maria José Solano 0a5a0efda6 feat(lua): don't complete private (_) fields after dot (.) #32690 2025-03-02 13:44:13 -08:00
Riley Bruins 65c7033cbe feat(comment): allow commentstring to be determined from node metadata
**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.
2025-03-02 18:38:13 +01:00
dundargoc 188ec19894 build!: turn off translations by default
The translation step prolongs the build time too much to be enabled by
default. Enable it by passing cmake flag `ENABLE_TRANSLATIONS=ON`.
2025-03-02 02:29:25 +01:00
zeertzjqandglepnir 1351383579 vim-patch:9.1.1161: preinsert requires bot "menu" and "menuone" to be set
Problem:  preinsert requires bot "menu" and "menuone" to be set,
          but "menu" is redundant (after v9.1.1160)
Solution: preinsert only requires menuone (glepnir)

closes: vim/vim#16763

https://github.com/vim/vim/commit/94a045ed56d7616c0cd0080d3f308d6cf9fbe64c

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-02 07:02:10 +08:00
zeertzjqandglepnir 26775183ff vim-patch:9.1.1160: Ctrl-Y does not work well with "preinsert" when completing items
Problem:  The 'preinsert' feature requires Ctrl-Y to confirm insertion,
          but Ctrl-Y only works when the popup menu (pum) is displayed.
          Without enforcing this dependency, it could lead to confusing
          behavior or non-functional features.

Solution: Modify ins_compl_has_preinsert() to check for both 'menu' and
          'menuone' flags when 'preinsert' is set. Update documentation
          to clarify this requirement. This avoids adding complex
          conditional behaviors. (glepnir)

fixes: vim/vim#16728
closes: vim/vim#16753

https://github.com/vim/vim/commit/a2c5559f297a18dc1ce3c4f1f9fd6204aed321c9

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-02 07:02:10 +08:00
brianhusterandDoug Kearns 47b748af54 vim-patch:0b82054: runtime(lua): Improve 'include' and make '*expr' functions script-local
- Prevent 'include' from matching variable assignments as calls to
  require() and others.
- Use script-local functions for 'includeexpr' and 'foldexpr'.
- Formatting fixes.

closes: vim/vim#16746

https://github.com/vim/vim/commit/0b8205484b703b4a5a569cd1b0ed876bbb13901f

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-03-02 06:46:26 +08:00
brianhusteranddkearns 2b0f967b77 vim-patch:00a00f5: runtime(lua): Update lua ftplugin and documentation
Problem:
- The doc says the default `g:lua_subversion` is 2, but in fact it is 3
  (see `runtime/syntax/lua.vim`)
- `includeexpr` doesn't work with module in `init.lua`

Solution:
- Update documentation
- Assign value to option `&include`
- Add function `LuaInclude` and assign it to `l:&includeexpr`

closes: vim/vim#16655

https://github.com/vim/vim/commit/00a00f5d3fc8dcf08e959c207a90f5902abc6a08

Co-authored-by: brianhuster <phambinhanctb2004@gmail.com>
Co-authored-by: dkearns <dougkearns@gmail.com>
2025-03-02 06:46:26 +08:00
Christian ClasonandChristian Brabandt ea4a7cc616 vim-patch:8ac975d: runtime(tar): fix syntax error in tar.vim
https://github.com/vim/vim/commit/8ac975d97e153205a82ef0177013260f59cc6a2e

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-03-01 23:03:10 +01:00
Lewis RussellandChristian Clason ec8922978e feat(treesitter): add more metadata to language.inspect() (#32657)
Problem: No way to check the version of a treesitter parser.

Solution: Add version metadata (ABI 15 parsers only) as well as parser state count and supertype information (ABI 15) in `vim.treesitter.language.inspect()`. Also graduate the `abi_version` field, as this is now the official upstream name.

---------

Co-authored-by: Christian Clason <c.clason@uni-graz.at>
2025-03-01 15:51:09 +00:00
Christian ClasonandJim Zhou 48e6147e64 vim-patch:56957ed: runtime(misc): add support for bzip3 to tar, vimball and gzip plugins
fixes: vim/vim#16751
closes: vim/vim#16755

https://github.com/vim/vim/commit/56957ed4109fb0c37922c6c37d5926cfe0a3313b

Co-authored-by: Jim Zhou <jimzhouzzy@gmail.com>
2025-03-01 13:21:55 +01:00
Luca Saccarola 7b4295390f docs(Open): add reference in documentation (#32678) 2025-02-28 23:14:01 +00:00
luukvbaal 86046c5a31 fix(marks): ineffective conceal_line callback optimization (#32662)
Problem:  _on_conceal_line callbacks are not invoked if callback has not
          let Nvim know it wants to receive them. But this may change on
          factors other than what is currently checked (changed buffer).
Solution: Forego this optimization, callback is still guarded behind
          'conceallevel'.
2025-02-28 13:36:25 +01:00
zeertzjqandYegappan Lakshmanan 7c6a9c5589 vim-patch:8.2.4607: sourcing buffer lines may lead to errors for conflicts
Problem:    Sourcing buffer lines may lead to errors for conflicts.
Solution:   Add the ++clear argument. (Yegappan Lakshmanan, closes vim/vim#9991)

https://github.com/vim/vim/commit/35dc17634dd6da5b90bd1b0160c4ed9e394f4b87

Documentation changes only. Vim9script is N/A.
Cherry-pick another documentation change for :source from latest Vim.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-02-28 18:21:08 +08:00
zeertzjqandYegappan Lakshmanan 6750d00fe9 vim-patch:8.2.4603: sourcing buffer lines is too complicated
Problem:    Sourcing buffer lines is too complicated.
Solution:   Simplify the code. Make it possible to source Vim9 script lines.
            (Yegappan Lakshmanan, closes vim/vim#9974)

https://github.com/vim/vim/commit/85b43c6cb7d56919e245622f4e42db6d8bee4194

This commit changes the behavior of sourcing buffer lines to always have
a script ID, although sourcing the same buffer always produces the same
script ID.

vim-patch:9.1.0372: Calling CLEAR_FIELD() on the same struct twice

Problem:  Calling CLEAR_FIELD() on the same struct twice.
Solution: Remove the second CLEAR_FIELD().  Move the assignment of
          cookie.sourceing_lnum (zeertzjq).

closes: vim/vim#14627

https://github.com/vim/vim/commit/f68517c1671dfedcc1555da50bc0b3de6d2842f6

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-02-28 18:21:08 +08:00
zeertzjqandYegappan Lakshmanan a3a9f86d4a vim-patch:8.2.4594: need to write script to a file to be able to source them
Problem:    Need to write script to a file to be able to source them.
Solution:   Make ":source" use lines from the current buffer. (Yegappan
            Lakshmanan et al., closes vim/vim#9967)

https://github.com/vim/vim/commit/36a5b6867bb6c0bd69c8da7d788000ab8a0b0ab0

Most code and test changes are reverted or modified again in patch
8.2.4603, so only port parts that are untouched in patch 8.2.4603.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-02-28 18:21:07 +08:00
Riley Bruins 9b25c68db2 fix(treesitter): correctly parse queries with combined injections 2025-02-28 09:33:02 +01:00
Christian ClasonandKonfekt 8c4c9ca192 vim-patch:3d75ec7: runtime(compiler): improve svelte-check
closes: vim/vim#16749

https://github.com/vim/vim/commit/3d75ec7401850e8a80ae7ab5ad1b84f47bc32095

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2025-02-28 09:32:42 +01:00
zeertzjq da219960cb vim-patch:85a50fe: runtime(doc): fix confusing docs for 'completeitemalign' (#32671)
closes: vim/vim#16743

https://github.com/vim/vim/commit/85a50fe825ba11a35ce654f7313b4350e3ba4b52
2025-02-28 08:28:24 +08:00
zeertzjqandDoug Kearns 567ab3c34f vim-patch:60bd140: runtime(vim): Update base-syntax, match Vim9 function calls after "|" (#32670)
Match Vim9 function calls after ex-bar.  These are also currently
matched but invalid syntax for legacy script.

fixes: vim/vim#16721
closes: vim/vim#16747

https://github.com/vim/vim/commit/60bd140256be4f567c28c60eb84be72c19a164bd

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-02-28 08:28:05 +08:00
David Briscoe 6a9555c0fa doc: clarify window-id, tab-id, nvim_set_current_x #32528
Problem:
Descriptions are somewhat vague. nvim_set_current_line modifies contents
but nvim_set_current_buf does not, etc.

Solution:
- Make it clear that these functions accept or return a winid/tabid by
  linking to that concept in help.
- Only these few files use the term "handles", so replace them with the
  more conventional terminology.
- Add a new help section for tab-ID. This concept is unique to neovim
  because vim exposes tabnr, but not tab handles. This section is
  modelled after `:h winid`.
2025-02-27 02:05:00 -08:00
Justin M. Keyes be1fbe38b3 feat(lua): vim.text.indent()
Problem:
Indenting text is a common task in plugins/scripts for
presentation/formatting, yet vim has no way of doing it (especially
"dedent", and especially non-buffer text).

Solution:
Introduce `vim.text.indent()`. It sets the *exact* indentation because
that's a more difficult (and thus more useful) task than merely
"increasing the current indent" (which is somewhat easy with a `gsub()`
one-liner).
2025-02-26 23:06:22 +01:00
Lewis Russell 0f24b0826a build: move all generator scripts to src/gen/
- 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')`
2025-02-26 16:54:37 +00:00
zeertzjqandKonfekt 9c43e5cd4a vim-patch:580e457: runtime(vim): make VimKeywordPrg even smarter for regexes
closes: vim/vim#16729

https://github.com/vim/vim/commit/580e457a2a5fa63b9be0bf5f2c81434e157bcc0a

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2025-02-26 07:31:49 +08:00
6db439ff01 vim-patch:094494b: runtime(vim): improve &keywordprg in ftplugin
- let keywordprg in vim filetype handle context-sensitive help calls by
  detecting the syntax group of the word under the cursor
- reformat whitespace
- add modeline

related: vim/vim#16677
closes: vim/vim#16680

https://github.com/vim/vim/commit/094494bf2eef8d788944b2b00b3361feb545d3ae

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
Co-authored-by: Andrew Radev <andrey.radev@gmail.com>
Co-authored-by: "D. Ben Knoble" <ben.knoble+github@gmail.com>
Co-authored-by: Gary Johnson <garyjohn@spocom.com>
Co-authored-by: Tim Pope <code@tpope.net>
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-02-26 07:31:03 +08:00
Luuk van Baal c3337e357a fix(treesitter): nil check query for has_conceal_line 2025-02-25 16:21:16 +01:00
Luuk van Baal 47aaddfa0d fix(lsp): resize hover window for concealed lines
Problem:  Height of a (markdown) `vim.lsp.util.open_floating_preview()`
          window can be reduced to account for concealed lines (after #31324).
Solution: Set the window height to the text height of the preview window.
          Set 'concealcursor' to avoid unconcealing the cursorline when
          entering the hover window.
2025-02-25 14:26:58 +01:00
Luuk van Baal 8ba047e33f feat(treesitter): vertical conceal support for highlighter
TSHighlighter now places marks for conceal_lines metadata. A new
internal decor provider callback _on_conceal_line was added that
instructs the highlighter to place conceal_lines marks whenever the
editor needs to know whether a line is concealed. The bundled markdown
queries use conceal_lines metadata to conceal code block fence lines.
2025-02-25 13:09:01 +01:00
Luuk van Baal f58e7d5fac feat(marks): add conceal_lines to nvim_buf_set_extmark()
Implement an extmark property that conceals lines vertically.
2025-02-25 13:09:01 +01:00
zeertzjqandDavid Mandelberg a31ccc3b1f vim-patch:9.1.1140: filetype: m17ndb files are not detected (#32618)
Problem:  filetype: m17ndb files are not detected
Solution: detect m17ndb files as m17ndb filetype,
          include filetype, syntax and indent files for the
          new filetype (David Mandelberg).

References:

https://www.nongnu.org/m17n/manual-en/m17nDBFormat.html describes the
format. https://git.savannah.nongnu.org/cgit/m17n/m17n-db.git/tree/ has
examples of the files.

closes: vim/vim#16696

https://github.com/vim/vim/commit/ed7d8e55ac232758fc14fd132994b4a09b19350b

Also adjust the xkb parent pattern according to dev_vimpatch.txt.

Co-authored-by: David Mandelberg <david@mandelberg.org>
2025-02-25 09:20:44 +00:00
zeertzjqandDoug Kearns 56fabcadb6 vim-patch:025dc48: runtime(vim): Update base-syntax, match :CompilerSet and :SynMenu commands (#32605)
closes: vim/vim#16713

https://github.com/vim/vim/commit/025dc48e88790133ef0da583b2ce5b9c2232ea9e

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-02-24 04:16:36 +00:00
Evgeni Chasnovski 268a3de0a7 feat(complete): CompleteDone reason "cancel", "discard" #32600
Problem: there is no way to distinguish between user's explicit
  completion stop/cancel and other automated reasons.

Solution: update "cancel" reason to be set only on explicit CTRL-e, and
  set intentionally vague "discard" otherwise.
2025-02-23 14:08:26 -08:00
Yi Ming 6bc7979044 fix(lsp): reset the applied hints on refresh request #32446 2025-02-23 08:48:08 -08:00
Justin M. Keyes 2a733ec6cc revert "feat(ftplugin): set 'omnifunc' of Lua to 'v:lua.vim.lua_omnifunc'" #32597
This reverts commit f398e3a61a.
2025-02-23 08:21:24 -08:00
Justin M. Keyes 9304a417af Merge #32503 feat(lsp): use the meta model to generate server capability map 2025-02-23 08:20:19 -08:00
Riley Bruins 0c9c140f91 refactor(treesitter): simplify parsing coroutine logic
Lua coroutines can yield across non-coroutine function boundaries,
meaning that we don't need to wrap each helper function in a coroutine
and resume it within `_parse()`. If we just have them yield when
appropriate, this will be caught by the top level `_parse()` coroutine,
and resuming the `_parse()` will resume from the position in the helper
function where we yielded last.
2025-02-23 17:12:58 +01:00
Phạm Bình An f398e3a61a feat(ftplugin): set Lua 'omnifunc' to vim.lua_omnifunc #32491
Problem:
- Many other ftplugin have defined 'omnifunc', but the Lua one doesn't
  define one, even though there is `vim.lua_omnifunc()`
- Users may want "stupid" completion to fix Lua config with
  `nvim --clean` in case they breaks it

Solution:
Set 'omnifunc' to 'v:lua.vim.lua_omnifunc' in ftplugin/lua.lua
2025-02-23 07:57:16 -08:00
Dan Sully b283736388 fix(lua): @private => @nodoc #32587
Problem:
vim.log.levels.* and vim.opt_local are marked `@private` but they should be `@nodoc`.

Solution:
Fix the annotation.
2025-02-23 07:51:12 -08:00
Maria José Solano d2cca606a1 fix(float): ensure floating window width can fit title 2025-02-23 10:32:20 +00:00
Christian ClasonandDavid Mandelberg 228fe50087 vim-patch:9.1.1134: filetype: Guile init file not recognized
Problem:  filetype: Guile init file not recognized
Solution: detect '.guile' file as scheme filetype
          (David Mandelberg)

References:

https://www.gnu.org/software/guile/manual/html_node/Init-File.html
> When run interactively, Guile will load a local initialization file
> from ~/.guile. This file should contain Scheme expressions for
> evaluation.

closes: vim/vim#16683

https://github.com/vim/vim/commit/41a6026f007facb1ada3ff2a63a054913432860c

Co-authored-by: David Mandelberg <david@mandelberg.org>
2025-02-23 00:19:53 +01:00
Christian ClasonandDavid Mandelberg 010684e024 vim-patch:9.1.1133: filetype: xkb files not recognized everywhere
Problem:  filetype: xkb files not recognized everywhere
Solution: detect xkb files in more places
          (David Mandelberg)

References:
https://xkbcommon.org/doc/current/user-configuration.html#user-config-locations

closes: vim/vim#16684

https://github.com/vim/vim/commit/b62bf814886185cb8607ce15051aa7017b8c88ba

Co-authored-by: David Mandelberg <david@mandelberg.org>
2025-02-23 00:19:53 +01:00
Christian ClasonandDavid Mandelberg 90958c3648 vim-patch:61af587: runtime(dockerfile): set comments in filetype plugin
closes: vim/vim#16698

https://github.com/vim/vim/commit/61af587f26f56be7d6b55f77e42cc89504942cc0

Co-authored-by: David Mandelberg <david@mandelberg.org>
2025-02-22 16:17:11 +01:00
Christian ClasonandKonfekt 5f11efe423 vim-patch:d15114c: runtime(compiler): include svelte-check compiler
closes: vim/vim#16704

https://github.com/vim/vim/commit/d15114c148e615b0c244e94bf91548299f6af047

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2025-02-22 16:17:11 +01:00
phanium e641155b02 fix(runtime): avoid E31 in ftplugin (#32578)
fix: twice nunmap in ftplugin
2025-02-22 14:17:35 +01:00
Christian Clason 2e5b560482 feat(treesitter): table of contents for checkhealth, markdown (#32282)
Problem: It's difficult to navigate large structured text files (vim
help, checkhealth, Markdown).

Solution: Support `gO` for table of contents and `]]`/`[[` for moving
between headings for all these filetypes using treesitter queries.

Refactor: colorization of highlight groups is moved to the `help` ftplugin
while headings-related functionality is implemented in a private
`vim.treesitter` module for possible future use for other filetypes.
2025-02-22 13:07:21 +01:00