In https://github.com/neovim/neovim/pull/34092 we changed the
healthcheck to display root markers as a concatenated list if the first
item in root_markers is a string (not a table). However, this does not
solve the general case, because root_markers can contain a string as the
first element, but a table as the 2nd element.
Because root_markers has a more complex structure we should always just
display it using vim.inspect, rather than adding a special case for when
all items are a string.
(cherry picked from commit f0c0c24ed7)
The root_markers field can now contain a table of tables (as of
https://github.com/neovim/neovim/pull/33485) and :checkhealth will show
an error in that case since Lua cannot concatenate a table of tables.
Ensure that tables contain strings before concatenating and if not, fall
back to using vim.inspect().
(cherry picked from commit 5ad01184f3)
Co-authored-by: Gregory Anders <greg@gpanders.com>
For notable changes, see runtime/doc/news.txt (or `:help news` in Nvim).
Following is a list of fixes/features.
FEATURES
--------------------------------------------------------------------------------
- db3b856779 defaults: map "grt" to LSP type_definition #34663
- ecf5164d2d lsp: pass resolved config to cmd() #34560
- 5d0766ddce vim.fs: vim.fs.root() can control priority #34413
FIXES
--------------------------------------------------------------------------------
- f2c4305114 api: add missing nargs field to user command Lua callbacks #34210
- aa6136f956 api: adjust fix for reconfiguring float "relative" (#34287)
- 6889f9168b api: populate lhsrawalt in nvim_get_keymap response
- 0d66963089 api: reconfiguring float "relative" does not clear "win" (#34271)
- 8d3b7b57c8 api: update topline when flushing with nvim__redraw() (#34346)
- 77eb278adf clipboard: enable cache for function providers #34470
- 0613faf596 column: missing redraw with virt_lines_leftcol (#34650)
- 4303337c77 diagnostics: validate opts.signs #34565
- 902c946bcd editorconfig: a custom property is treated as a section (#34445)
- 7b2119dbd9 exrc: exrc knows its own location #34638
- 7da0c46e1b health: bad format() call #34906
- c97ad3cb41 health: floating window closes when opening TOC (gO)
- 68d204462c health: highlight group conflicts with help #34616
- 282f9fb816 incsearch: include compsing characters with Ctrl-L
- d0a24ea03e lsp: _cancel_all_requests() tries to cancel completed requests #34105
- 4621527f59 lsp: add `RequestFailed` error code constant #34645
- 1077374380 lsp: advertise supported fold kinds (#34461)
- 0f1cada0f7 lsp: announce diagnostic tag support (#34436)
- ff8acfffd2 lsp: include client ID when receiving unknown fold kind (#34535)
- c13eba5254 lsp: only auto-detach lsp.config enabled clients #34325
- ea8db9003b lsp: use correct deprecation function (#34518)
- f7b1b0595d menu: fix listing of submenus (#34315)
- adf31505d8 messages: make swapfile attention message part of prompt (#34414)
- 89959ab9dc messages: recognize cmdline one_key/number prompt State (#34206)
- ec84c8df0e msgpack: flush incomplete big UI event before packing RPC event
- d9c10ea753 redraw: update curswant for Visual selection (#34241)
- 388b559848 runtime: no conceal in qf on :lopen #34854
- d9b9514e8e startup: make startup windows if there are only floating windows (#34349)
- ef68eae09a term: terminal attr index may exceed TERM_ATTRS_MAX #34318
- c4a760c734 terminal: don't disable scrolloff for non-terminal buffers (#34451)
- 36c6f488e4 terminal: fix OSC 8 parsing (#34424)
- 68677eb477 terminal: stack overflow when too many csi args (#34012)
- 3d5be364bc treesitter: enable a gc for wasmtime
- a80bdf0d9b treesitter: ensure TSLuaTree is always immutable
- 07d9197840 treesitter: ensure TSNode's tree is immutable
- 7184230e94 treesitter: ensure window is valid in async parsing #34385
- 8183eb32e1 treesitter: scope highlight state per window
- dfeec113be treesitter: support multiple `@injection.content` captures
- 70b4e7948f tui: avoid memory leak and compiler warning on Windows (#34225)
- 6f8efea940 tui: check for title support correctly (#34866)
- 43804477ca tui: don't crash when nvim__screenshot() is called with bad path (#34594)
- 0eec4a8ecc tui: wait for embedded server's exit code
- bfcf541a9e tutor: cannot find tutors in pack/*/start/* #34689
- f9f0345eba vim.json: loss of precision on integers >14 digits #34876
- 203d4f916d vim.system: clear_env=true gives an invalid env to uv.spawn #33955
- e732cbe36c vim.system: env=nil passes env=nil to uv.spawn
- 7286e514f2 vim.version: vim.VersionRange:has(<prerelease>) (#33324)
- 742ea00742 window: don't enter unfocusable or hidden prevwin (#34486)
- e0ddf93bb0 windows: don't set window icon on SIGHUP #34260
VIM PATCHES
--------------------------------------------------------------------------------
- ae05e0399b 0fb6cea: runtime(lua): update 'path' option in filetype plugin #33876
- 7ef602d470 2323f22: runtime(new-tutor): add chapter two to the interactive tutorial
- 2d13ae0dd4 7a734b7: tests: fix typo in comment (after v9.1.1511)
- d32a4dd4b0 9.1.1404: wrong link to Chapter 2 in new-tutor
- 28531d18f0 9.1.1421: tests: need a test for the new-style tutor.tutor (#34267)
- d28ad6e03f 9.1.1450: Session has wrong arglist with :tcd and :arglocal (#34430)
- 9ffa94b07b 9.1.1463: Integer overflow in getmarklist() after linewise operation (#34532)
- d5cbc99358 9.1.1482: scrolling with 'splitkeep' and line() (#34670)
- 2df746e4e8 9.1.1506: tests: missing cleanup in Test_search_cmdline_incsearch_highlight() (#34748)
- 730a5e0599 9.1.1511: tests: two edit tests change v:testing from 1 to 0
- 87ba1d7465 9.1.1521: completion: pum does not reset scroll pos on reopen with 'noselect' (#34836)
- 222b3d5021 bfeefc4: runtime(doc): clarify the effect of exclusive single char selections (#34289)
- 9d8c5119e2 eb59129: runtime(typescript): remove Fixedgq() function from indent script (#34334)
Problem:
Bad format() call on PUC Lua
Error: Failed to run healthcheck for "vim.health" plugin. Exception:
runtime/lua/vim/health/health.lua:89: bad argument #1 to 'format' (string expected, got nil)
Solution:
Avoid passing nil.
(cherry picked from commit 2422fbdd5f)
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
bump
* tree-sitter to v0.25.6
* tree-sitter-c to v0.24.1
* tree-sitter-lua to v0.4.0
* tree-sitter-vim to v0.7.0 (and update queries)
* tree-sitter-vimdoc to v4.0.0
* tree-sitter-query to v0.6.2
* tree-sitter-markdown to v0.5.0
Problem:
No conceal in qf on `lopen` since 74fcc945. Repro:
nvim --clean +'tab Man ls' +'norm gO' +lclose +lopen
Solution:
Consider "Table of contents" title.
(cherry picked from commit 76f6868e0a)
fix(health): floating window closes when opening TOC (gO) #34794
Problem: Health check floating window gets closed when pressing 'gO' to show TOC because LSP floating preview system auto-closes on BufEnter events triggered by :lopen.
Solution: Temporarily disable BufEnter event for the current window during TOC operations and adjust window layout to prevent overlap.
(cherry picked from commit 28b7c2df52)
Co-authored-by: glepnir <glephunter@gmail.com>
Problem:
The previous fix in #34314 relies on copying the tree in `tree_root` to
ensure the `TSNode`'s tree cannot be mutated. But that causes the
problem where two calls to `tree_root` return nodes from different
copies of a tree, which do not compare as equal. This has broken at
least one plugin.
Solution:
Make all `TSTree`s on the Lua side always immutable, avoiding the need
to copy the tree in `tree_root`, and make the only mutation point,
`tree_edit`, copy the tree instead.
(cherry picked from commit 168bf0024e)
731e616a79 made it so passing `{env = nil, clear_env = true }` would
pass `{env = {}}` to `vim.uv.spawn`.
However this is not what `clear_env` is (arguably) supposed to do.
If `env=nil` then that implies the uses wants `vim.uv.spawn()` to use
the default environment. Adding `clear_env = true` simply prevents
`NVIM` (the base environment) from being added.
Fixes#34730
(cherry picked from commit 4eebc46930)
Problem:
'exrc' files are inherently bound to their location / workspace and
therefore require to "know" their location on the filesystem. However,
currently using `debug.getinfo(1, 'S')` returns `"<nvim>"`.
Solution:
Include the filepath as chunkname in `loadstring()` and `nlua_exec()`.
(cherry picked from commit f7c939fa7a)
Problems:
- Unlike in Vim, Neovim does not report pack/*/start/* in the resolved value of 'rtp' (see `:help packages-runtimepath`)
- This means that the tutor plugin cannot find the tutors in pack/*/start/*
Solution:
- Use nvim_list_runtime_paths() instead of &rtp
(cherry picked from commit bff7d3fd9f)
Problem: tests: need a test for the new-style tutor.tutor, patch
9.1.1384 broke the expected positions for the signs
Solution: Update all number keys in tutor.tutor.json to match the
correct line numbers in tutor.tutor, replace tabs by spaces,
add a screen-dump test to verify it does not regress
(Pham Bình An)
closes: vim/vim#17416a541f1de2b
(cherry picked from commit f1f106be3d)
Problem:
`vim.version.range('>=0.10'):has('0.12.0-dev')` returns false, which is
wrong per semver.
Solution:
`vim.VersionRange:has()` shouldn't have special handling for prereleases
(Why would we need it when `__eq`, `__lt`, `__le` already handle
prereleases?).
Closes#33316
Problem:
In setup_env, some needed logic is bypassed when clear_env=true.
Solution:
Drop the early return in setup_env().
Co-authored-by: BirdeeHub <birdee@localhost>
(cherry picked from commit 731e616a79)
The type annotation for `vim.lsp.ClientConfig.cmd` was changed,
but the update was not propagated to `vim.lsp.Config`.
(cherry picked from commit 150513a163)
Problem:
In LSP configs, the function form of `cmd()` cannot easily get the
resolved root dir (workspace). One of the main use-cases of a dynamic
`cmd()` is to be able to start a new server whose binary may be located
*in the workspace* ([example](https://github.com/neovim/nvim-lspconfig/pull/3912)).
Compare `reuse_client()`, which also receives the resolved config.
Solution:
Pass the resolved config to `cmd()`.
(cherry picked from commit 32f30c4874)
Co-authored-by: Julian Visser <12615757+justmejulian@users.noreply.github.com>
Problem:
With these settings, copy/pasting `blockwise-visual` (with `CTRL+V`)
incorrectly pastes as a `linewise` mode because `regtype` is ignored:
vim.opt.clipboard = 'unnamedplus'
vim.g.clipboard = 'osc52'
To reproduce: press `CTRL+V` and select some characters press `p` and
observe that it is pasted in `linewise` mode.
Solution:
Enable the [clipboard.vim](https://github.com/neovim/neovim/blob/master/runtime/autoload/provider/clipboard.vim#L281-L283))
cache for function providers, so that `regtype` is maintained for the OSC52
clipboard provider.
(cherry picked from commit ac12dc49cc)
Problem:
The cancel function returned by `vim.lsp.buf_request` tries to cancel
all the requests, including those that have already been completed,
causing "Cannot find request with id ... whilst attempting to cancel"
errors to be logged when it is called.
Solution:
Only cancel the requests that are present in `client.requests`.
(cherry picked from commit a9b8a8dc6c)
Problem: A custom property containing a pair of square brackets will be
treated as a section.
Solution: Change the logic parsing a section, remove the first match
regex `%b[]`.
Signed-off-by: fortime <palfortime@gmail.com>
(cherry picked from commit 966b1da183)
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.
(cherry picked from commit bac133e4b6)
feat(vim.fs): vim.fs.root() can control priority
Adds the capability of controlling the priority of searched markers in
vim.fs.root() by nesting lists.
(cherry picked from commit 0f0b96dd0f)
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)
```
(cherry picked from commit 58d85cd03d)
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.
(cherry picked from commit 8b41df185c)
**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.
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.
(cherry picked from commit e5c5b563ec)
Problem: wrong link to Chapter 2 in vim-01-beginner.tutor
Solution: Fix the link to Chapter 2, add test for links in tutor files
(Phạm Bình An)
In order to write the test, I exposed the function `s:GlobTutorials` as
`tutor#GlobTutorials` and make it also accept a `locale` argument.
closes: vim/vim#17356e8302da74a
Co-authored-by: Phạm Bình An <111893501+brianhuster@users.noreply.github.com>
(cherry picked from commit f791ae82e5)
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#17412closes: vim/vim#17452eb59129d2c
(cherry picked from commit 4e71d3bfab)
Problem:
Despite the name, `builtin.txt` only includes Vimscript functions, which
is confusing, especially to people who only use Lua to configure Nvim
Solution: From justinmk's suggestion
- Rename `builtin.txt` to `vimfn.txt`
- Rename `eval.txt` to `vimeval.txt`
- The tags `*builtin.txt*` and `*eval.txt*` should be kept for Vim-patches
Closes#33743
(cherry picked from commit 9d5eb3eda5)
Problem: `TSLangInfo` annotation does not reflect the structure returned
by `vim.treesitter.language.inspect()`.
Solution: Move version information under new (optional since ABI 15 only)
`TSLangMetadata` field.
(cherry picked from commit f82219c490)