9136 Commits

Author SHA1 Message Date
bac133e4b6 fix(lsp): announce diagnostic tag support (#34436)
This commit also adds a type annotation to the returned client
capabilities table, because without it lua_ls does not provide
autocompletion for the fields within the table.
2025-06-10 21:26:06 -07:00
79ce71430f vim-patch:bfa1636: runtime(doc): update documentation on tabstop settings (#34433)
Unify the treatment of tabstop, correct errors and deprecate smarttab
usage.

closes: vim/vim#17444

bfa16364f1

Co-authored-by: Damien Lejay <damien@lejay.be>
2025-06-10 23:53:35 +00:00
8ea18de959 vim-patch:274efcc: runtime(vim): Update base-syntax, contain let-heredocs (#34431)
Limit heredoc matches to assignment statements.  Matching these at the
top level is very slow.

closes: vim/vim#17473

274efcc7e6

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-10 23:35:59 +00:00
c2aa5fd915 test: :restart works on Windows 2025-06-10 23:00:38 +08:00
93925fe020 vim-patch:446a98f: runtime(rpl): set commentstring option in ftplugin
closes: vim/vim#17487

446a98f0b6

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-10 09:10:59 +02:00
4387c26691 vim-patch:9e9fe66: runtime(postscr): set commentstring option in ftplugin
closes: vim/vim#17486

9e9fe66437

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-10 09:10:59 +02:00
b7cb7fe51c vim-patch:de535cf: runtime(occam): set commentstring option in ftplugin
closes: vim/vim#17485

de535cfe77

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-10 09:10:59 +02:00
5394320a67 vim-patch:df63097: runtime(lprolog): set com, cms options for lambda prolog
closes: vim/vim#17481

df630970bf

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-10 09:10:59 +02:00
2f167c53ac vim-patch:aa9fc8e: runtime(vue): set 'com' and 'cms' options in ftplugin
closes: vim/vim#17479

aa9fc8eb94

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-10 09:10:59 +02:00
2c80b05cbd vim-patch:9.1.1446: filetype: cuda-gdb config files are not recognized
Problem:  filetype: cuda-gdb config files are not recognized
Solution: detect .cuda-gdbinit and cuda-gdbinit files as gdb filetype
          (Wu Zhenyu)

closes: vim/vim#17471

601cfa9a23

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2025-06-10 09:10:47 +02:00
cb4559bc32 feat(lsp): workspace diagnostic support (#34262)
* refactor(lsp): remove underscore prefix from local variables

* feat(lsp): workspace diagnostic support
2025-06-09 13:02:00 -04:00
d75ffa5934 feat(lsp): static registration support (#34371) 2025-06-09 13:01:26 -04:00
2f0fbdaa48 feat(vim.fs): root() can specify "equal priority" #34276 2025-06-09 09:31:37 -07:00
2d980e37c8 docs(diagnostics): default keymaps #34400 2025-06-09 08:44:01 -07:00
f2e60d000e fix: fn.exists() typos (#34390)
Problem:  `exists()` checks should test for being equal to 1 rather than truthy, and extui check can be more restrictive.
Solution:  Adjust `exists()` guards to equal 1 and use `matchparen#CursorMoved`.
2025-06-09 09:07:38 +02:00
58d85cd03d fix(treesitter): ensure window is valid in async parsing #34385
Problem: Error occurs if window is invalid in the middle of parsing.

Solution: Check if window is valid in parsing.

- Error
```
vim.schedule callback: ...im/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:485: Invalid window id: 1037
stack traceback:
	[C]: in function 'nvim__redraw'
	...im/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:485: in function 'cb'
	...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:494: in function '_run_async_callbacks'
	...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:550: in function <...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:529>
```

- Reproduce script
```lua
local bufnr = vim.api.nvim_create_buf(false, true)
local many_lines = vim.fn["repeat"]({ "local test = 'a'" }, 100000)
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, many_lines)
local window = vim.api.nvim_open_win(bufnr, true, {
  relative = "editor",
  row = 0,
  col = 0,
  width = 10,
  height = 10,
})
vim.bo.filetype = "lua"
vim.schedule(function()
  vim.api.nvim_win_close(window, true)
end)
```
2025-06-08 16:44:40 -07:00
8b41df185c fix(treesitter): support multiple @injection.content captures
Before, only the last capture's range would be counted for injection.
Now all captured ranges will be counted in the ranges array. This is
more intuitive, and also provides a nice solution/alternative to the
"scoped injections" issue.
2025-06-08 18:23:22 +02:00
775e845d59 vim-patch:80a7921: runtime(nginx): Add NGINX directive for background cache updates
Docs: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_background_update

closes: vim/vim#17458

80a7921a02

Co-authored-by: S0AndS0 <strangerthanbland@gmail.com>
2025-06-08 16:53:50 +02:00
00bec1fd90 vim-patch:partial:8f7256a (#34368)
vim-patch:partial:8f7256a: runtime(doc): fix some style issues and remove obsolete docs

8f7256a5ee

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-06-08 09:59:02 +08:00
a1fc8bc17c vim-patch:834bb85: runtime(vim): vimHLGroup is not highlighted correctly
Problem: vimHLGroup is not highlighted in "hi def link"
          and "hi clear" commands
Solution: highlight vimHLGroup similarly to vimGroup
          (Eisuke Kawashima)

closes: vim/vim#17450

834bb85172

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-06-08 08:42:17 +08:00
a118597290 vim-patch:6acca4b: runtime(vim): remove trailing whitespace in Vim syntax generator
related: vim/vim#17450

6acca4bc59

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-06-08 08:39:03 +08:00
21a2411763 vim-patch:1cccdeb: runtime(vim): Update base-syntax, improve Vim9 block start pattern
The opening curly brace must be followed by whitespace, comment or
trailing bar.

closes: vim/vim#17454

1cccdebc0f

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-08 08:38:32 +08:00
52c61d9690 feat: make :restart work for remote UI (#34354) 2025-06-07 22:10:34 +00:00
faae1e72a2 fix(treesitter): scope highlight state per window #34347
**Problem:** There is a lot of distracting highlight flickering when
editing a buffer with multiple open windows. This is because the
parsing/highlighting state is shared across all windows.

**Solution:** Greatly reduce flicker in window splits by scoping the
highlighter state object and the `parsing` state object to each
individual window, so there is no cross-window interference.
2025-06-07 09:27:46 -07:00
96a0e5f265 docs: lua, UI events #34261 2025-06-07 07:49:04 -07:00
3b6084ddf4 fix: type fixes
Type fixes caught by emmylua
2025-06-06 15:36:48 +01:00
744674900f refactor(treesitter): avoid unnecessarily copying tree
node:tree() now already copies the tree before returning it, for memory
safety reasons.
2025-06-06 15:35:52 +01:00
cb036cae5f fix(extui): use visible to determine active "more" (#34327)
Problem:  Current window is checked to determine whether "more" window
          is open. Making it the current window is scheduled in case the
          cmdwin is open so this can be too late.
          "cmdline_hide" may be emitted when the topline is
          temporarily invalid (after incsearch->restore_viewstate()).
Solution: Use the window visibility to determine an active "more"
          window instead.
          Don't nvim__redraw->flush the "cmdline_hide" event (a normal
          will already happen).
2025-06-06 16:04:45 +02:00
e5c5b563ec fix(lsp): only auto-detach lsp.config enabled clients #34325
Problem: A custom server (initialized through `vim.lsp.start`) gets
         unexpectedly detached.

Solution: Only auto-detach the clients enabled through `vim.lsp.enable`
          to prevent unexpected behavior.
2025-06-06 06:26:50 -07:00
4e71d3bfab vim-patch:eb59129: runtime(typescript): remove Fixedgq() function from indent script (#34334)
Problem:
1. The `Fixedgq()` function is broken (see vim/vim#17412)
2. The `'formatexpr'` for Typescript is not documented, which causes
   confusion to users when they try to set `'formatprg'`, since
   `'formatexpr'` always takes precedence over `'formatprg'`. See also
   https://github.com/HerringtonDarkholme/yats.vim/issues/209
3. Typescript already has a very good and popular formatter called
   `prettier`, that can be easily integrated to Vim via `'formatprg'`
   (see vim/vim#16989). I don't think there are any good reasons to reinvent a
   half-baked version in Vim.

Solution:  Remove the Fixedgq() 'formatexpr' function.

fixes: vim/vim#17412
closes: vim/vim#17452

eb59129d2c
2025-06-06 07:47:55 +08:00
2b21c9c23f fix(diagnostic): ensure autocmd always is always sent diagnostics 2025-06-05 13:02:56 +01:00
b6b35cb557 vim-patch:bb78ea2: runtime(mbsync): Add support for TLSType in syntax script
closes: vim/vim#17438

bb78ea23c6

Co-authored-by: Filippo Bonazzi <filippo.bonazzi@suse.com>
2025-06-05 09:16:38 +02:00
1c417b565e vim-patch:9.1.1432: GTK GUI: Buffer menu does not handle unicode correctly (#34313)
Problem:  GTK GUI: Buffer menu does not handle unicode correctly
Solution: Get rid of the BMHash() function (SUN Haitao)

fixes: vim/vim#17403
closes: vim/vim#17405

08896dd330

Co-authored-by: SUN Haitao <sunhaitao@devtaste.com>
2025-06-05 09:19:22 +08:00
a5bbdbb5d5 vim-patch:dfed077: runtime(doc): fix small errors from rev 2090405de5bb66facc29c74
- update the netrw window to current version (and trim it slightly to 80
  chars)
- remove a trailing double quote

dfed077e06

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Antonio Giovanni Colombo <azc100@gmail.com>
2025-06-05 06:32:13 +08:00
038fb30ece vim-patch:d6c9ac9: runtime(doc): clarify the effect of 'smarttab'
closes: vim/vim#17426

d6c9ac97a0

Co-authored-by: Damien Lejay <damien@lejay.be>
2025-06-05 06:31:09 +08:00
5e4700152b fix(extui): copy window config to new tabpage (#34308)
Problem:  When opening a new tabpage, extui windows are initialized with
          their default config. Window visiblity/dimensions on other
          tabpages may get out of sync with their buffer content.
Solution: Copy the config of the window to the new tabpage.
          No longer keep track of the various windows on each tabpage.
          Close windows on inactive tabpages instead (moving them could
          be more efficient but is currently not supported in the API).
2025-06-04 19:59:36 +02:00
f577bb024e docs: getreg() type #34215
```lua
---@type string
local _a = vim.fn.getreg('a', 1)

---@type string[]
local _b = vim.fn.getreg('a', 1, 1)
```
2025-06-04 09:26:56 -07:00
dd9ac565d8 Merge pull request #34294 from glepnir/vim-9.1.1426
vim-patch:9.1.{1426,1428}: register completion improve
2025-06-04 13:46:19 +08:00
3d1f907912 vim-patch:2090405: runtime(doc): make examples verbatim to prevent conceal/tag parsing (#34299)
closes: vim/vim#17437

2090405de5
2025-06-04 05:55:24 +08:00
533cc0ab35 fix(vim.diagnostic): improve typing
Problem:

`vim.diagnostic.set()` doesn't actually accept a list of
`vim.Diagnostic` as internally `vim.diagnostic.set()` normalizes the
diagnostics and this normalization is assumed throughout the module.

Solution:

- Add a new type `vim.Diagnostic.Set` which is the input to `vim.diagnostic.set()`

- `col` is now an optional field and defaults to `0` to be consistent
  with `vim.diagnostic.match()`.

- Change `table.insert(t, x)` to `table[#table + 1] = x` for improved
  type checking.
2025-06-03 20:25:07 +01:00
9641ad9369 fix(diagnostics): diagnostic just after EOL is not highlighted #34085
Fixes #34013

Problem:
when diagnostic is set right after EOL, underline handler looks
inconsistent compared to other handlers, visually underline is shown
starting from the next line. On top of that it's also inconsistent with
open_float and jump.

Solution:
clamp starting column position in underline handler to be right before
EOL to make it visible and consistent with other handlers, open_float
and jump.
2025-06-03 07:22:36 -07:00
3991f14621 fix(glob): handling commas in letter pattern #34170 2025-06-03 06:36:44 -07:00
eb10852804 vim-patch:9.1.1426: completion: register contents not completed
Problem:  CTRL-X CTRL-R only completes individual words from registers,
          making it difficult to insert complete register content.
Solution: Add consecutive CTRL-X CTRL-R support - first press completes
          words, second press completes full register lines, similar to
          CTRL-X CTRL-L and CTRL-X CTRL-P behavior (glepnir).

closes: vim/vim#17395

d5fdfa5c9c

Co-authored-by: glepnir <glephunter@gmail.com>
2025-06-03 16:25:49 +08:00
049877d379 fix(tui): make :restart use new size after terminal resize (#34282) 2025-06-03 00:18:04 +00:00
304a9baebd vim-patch:3993cd6: runtime(vim): Update base-syntax, bug fixes (#34288)
- Contain :profdel arguments.
- Fix string highlighting immediately after lambda -> operators.

Reported by Aliaksei Budavei.

closes: vim/vim#17427

3993cd619a

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-02 23:58:11 +00:00
aa4fa24963 vim-patch:bfeefc4: runtime(doc): clarify the effect of exclusive single char selections (#34289)
closes: vim/vim#17410

bfeefc474a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-06-02 23:54:29 +00:00
eeff6ca8ff vim-patch:9.1.1409: using f-flag in 'complete' conflicts with Neovim
Problem:  using f-flag in 'complete' conflicts with Neovims filename
          completion (glepnir, after v9.1.1301).
Solution: use upper-case "F" flag for completion functions
          (Girish Palya).

fixes: vim/vim#17347
closes: vim/vim#17378

14f6da5ba8

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-06-03 06:30:47 +08:00
13aec582b4 vim-patch:fa8b7db: runtime(doc): tweak documentation style in options.txt
closes: vim/vim#17229

fa8b7db99a

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-06-03 06:30:47 +08:00
b6acf6112b vim-patch:9.1.1311: completion: not possible to limit number of matches
Problem:  completion: not possible to limit number of matches
Solution: allow to limit the matches for 'complete' sources by using the
          "{flag}^{limit}" notation (Girish Palya)

This change extends the 'complete'  option to support limiting the
number of matches returned from individual completion sources.

**Rationale:** In large files, certain sources (such as the current
buffer) can generate an overwhelming number of matches, which may cause
more relevant results from other sources (e.g., LSP or tags) to be
pushed out of view. By specifying per-source match limits, the
completion menu remains balanced and diverse, improving visibility and
relevance of suggestions.

A caret (`^`) followed by a number can be appended to a source flag to
specify the maximum number of matches for that source. For example:
```
  :set complete=.^9,w,u,t^5
```
In this configuration:
- The current buffer (`.`) will return up to 9 matches.
- The tag completion (`t`) will return up to 5 matches.
- Other sources (`w`, `u`) are not limited.

This feature is fully backward-compatible and does not affect behavior
when the `^count` suffix is not used.

The caret (`^`) was chosen as the delimiter because it is least likely
to appear in file names.

closes: vim/vim#17087

0ac1eb3555

Cherry-pick test_options.vim change from patch 9.1.1325.

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-06-03 06:30:47 +08:00
7651c43252 vim-patch:9.1.1301: completion: cannot configure completion functions with 'complete'
Problem:  completion: cannot configure completion functions with
          'complete'
Solution: add support for setting completion functions using the f and o
          flag for 'complete' (Girish Palya)

This change adds two new values to the `'complete'` (`'cpt'`) option:
- `f` – invokes the function specified by the `'completefunc'` option
- `f{func}` – invokes a specific function `{func}` (can be a string or `Funcref`)

These new flags extend keyword completion behavior (e.g., via `<C-N>` /
`<C-P>`) by allowing function-based sources to participate in standard keyword
completion.

**Key behaviors:**

- Multiple `f{func}` values can be specified, and all will be called in order.
- Functions should follow the interface defined in `:help complete-functions`.
- When using `f{func}`, escaping is required for spaces (with `\`) and commas
  (with `\\`) in `Funcref` names.
- If a function sets `'refresh'` to `'always'`, it will be re-invoked on every
  change to the input text. Otherwise, Vim will attempt to reuse and filter
  existing matches as the input changes, which matches the default behavior of
  other completion sources.
- Matches are inserted at the keyword boundary for consistency with other completion methods.
- If finding matches is time-consuming, `complete_check()` can be used to
  maintain responsiveness.
- Completion matches are gathered in the sequence defined by the `'cpt'`
  option, preserving source priority.

This feature increases flexibility of standard completion mechanism and may
reduce the need for external completion plugins for many users.

**Examples:**

Complete matches from [LSP](https://github.com/yegappan/lsp) client. Notice the use of `refresh: always` and `function()`.

```vim
set cpt+=ffunction("g:LspCompletor"\\,\ [5]). # maxitems = 5

def! g:LspCompletor(maxitems: number, findstart: number, base: string): any
    if findstart == 1
        return g:LspOmniFunc(findstart, base)
    endif
    return {words: g:LspOmniFunc(findstart, base)->slice(0, maxitems), refresh: 'always'}
enddef
autocmd VimEnter * g:LspOptionsSet({ autoComplete: false, omniComplete: true })
```

Complete matches from `:iabbrev`.

```vim
set cpt+=fAbbrevCompletor

def! g:AbbrevCompletor(findstart: number, base: string): any
    if findstart > 0
        var prefix = getline('.')->strpart(0, col('.') - 1)->matchstr('\S\+$')
        if prefix->empty()
            return -2
        endif
        return col('.') - prefix->len() - 1
    endif
    var lines = execute('ia', 'silent!')
    if lines =~? gettext('No abbreviation found')
        return v:none  # Suppresses warning message
    endif
    var items = []
    for line in lines->split("\n")
        var m = line->matchlist('\v^i\s+\zs(\S+)\s+(.*)$')
        if m->len() > 2 && m[1]->stridx(base) == 0
            items->add({ word: m[1], info: m[2], dup: 1 })
        endif
    endfor
    return items->empty() ? v:none :
        items->sort((v1, v2) => v1.word < v2.word ? -1 : v1.word ==# v2.word ? 0 : 1)
enddef
```

**Auto-completion:**

Vim's standard completion frequently checks for user input while searching for
new matches. It is responsive irrespective of file size. This makes it
well-suited for smooth auto-completion. You can try with above examples:

```vim
set cot=menuone,popup,noselect inf

autocmd TextChangedI * InsComplete()

def InsComplete()
    if getcharstr(1) == '' && getline('.')->strpart(0, col('.') - 1) =~ '\k$'
        SkipTextChangedIEvent()
        feedkeys("\<c-n>", "n")
    endif
enddef

inoremap <silent> <c-e> <c-r>=<SID>SkipTextChangedIEvent()<cr><c-e>

def SkipTextChangedIEvent(): string
    # Suppress next event caused by <c-e> (or <c-n> when no matches found)
    set eventignore+=TextChangedI
    timer_start(1, (_) => {
        set eventignore-=TextChangedI
    })
    return ''
enddef
```

closes: vim/vim#17065

cbe53191d0

Temporarily remove bufname completion with #if 0 to make merging easier.

Co-authored-by: Girish Palya <girishji@gmail.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: glepnir <glephunter@gmail.com>
2025-06-03 06:30:46 +08:00