Problem: filetype: Conda configuration files are not recognized
Solution: detect '.condarc' and 'condarc' files as yaml filetype.
(zeertzjq)
closes: vim/vim#16162876de275cb
Using the "supports_method" function with a client capability inside of
an LspAttach autocommand is the preferred method to do this, so we
should be showing users how to do it.
In particular, make the distinction and interaction between "noinsert"
and "noselect" clearer as it was very confusing before.
closes: vim/vim#16148768728b487
Co-authored-by: dundargoc <gocdundar@gmail.com>
* refactor(shared): extract `vim._list_insert` and `vim._list_remove`
* feat(lsp): add `vim.lsp.foldexpr()`
* docs(lsp): add a todo for state management
* feat(lsp): add `vim.lsp.folding_range.foldclose()`
* feat(lsp): schedule `foldclose()` if the buffer is not up-to-date
* feat(lsp): add `vim.lsp.foldtext()`
* feat(lsp): support multiple folding range providers
* refactor(lsp): expose all folding related functions under `vim.lsp.*`
* perf(lsp): add `lsp.MultiHandler` for do `foldupdate()` only once
**Problem:** The `context` parameter for `references()` is just typed as
a table, which is unhelpful.
**Solution:** Properly type it as an `lsp.ReferenceContext`!
Problem: %! item not allowed for 'rulerformat'
(yatinlala)
Solution: also allow to use %! for rulerformat option
(Yegappan Lakshmanan)
fixes: vim/vim#16091closes: vim/vim#16118ac023e8baa
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: The warning message is the same in different functions.
It is not convenient to locate the specific function name
Solution: add function name in warning message
Enabling private DEC mode 2031 tells the terminal to notify Nvim
whenever the OS theme changes (i.e. light mode to dark mode or vice
versa) or the terminal emulator's palette changes. When we receive one
of these notifications we query the terminal color's background color
again to see if it has changed and update the value of 'background' if
it has.
We only do this though if the user has not explicitly set the value of
'bg' themselves. The help text is updated slightly to hint to users that
they probably shouldn't set this value: on modern terminal emulators
Nvim is able to completely determine this automatically.
Problem:
`vim.loader.disable` does not conform to `:help dev-name-common` and
`:help dev-patterns`.
Solution:
- Add `enable` parameter to `vim.loader.enable`
- Remove `vim.loader.disable`
- Note the change in `:help news-breaking-dev` (HEAD changes).
- This is not a breaking change (except to "HEAD") because
`vim.loader` is marked "experimental".
previous: 26765e8461
Problem:
The default unimpaired mappings display an empty line after the
command's output. This results (with default configuration) in the
`Press ENTER or type command to continue` prompt to be displayed, like
so:
```
(2 of 16): item2
Press ENTER or type command to continue
```
Solution:
The cause is that we're checking the second return value from
`pcall(vim.api.nvim_cmd, opts, {})` to determine whether the call was
successful. `nvim_cmd` returns an empty string on success, so this value
is an empty string in the successful path which we then display.
The fix is simple: check the first return value instead which is the
"status code" of the call.
Problem:
LSP spec uses the term "position encoding" where we say "offset encoding".
Solution:
- Rename it everywhere except `vim.lsp.Client.offset_encoding` (which would be breaking).
- Mention "position encoding" in the documentation for `vim.lsp.Client.offset_encoding`.
Problem: floaing preview window can be closed by some
ex commands like `only` `fclose` which will not clean the bufvar
Solution: use WinClosed event with floating_winnr for clean
bufnr, and add test cases for vim.lsp.util.open_floating_preview
Problem:
Since [version 3.17](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocuments),
LSP supports specifying the position encoding (aka offset encoding) supported by
the client through `positionEncoding`. Since #31209, Nvim fully supports
`utf-8`, `utf-16`, and `utf-32` encodings.
Previously, nvim assumed all clients for a buffer had the same
`offset_encoding`, so:
* Nvim provides `vim.lsp._get_offset_encoding()` to get `offset_encoding`, but
this function is incorrect because `offset_encoding` is per-client, not
per-buffer.
* Based on the strategy of `vim.lsp._get_offset_encoding()`,
`vim.lsp.util.make_position_params()`, `vim.lsp.util.make_range_params()`, and
`vim.lsp.util.make_given_range_params()` do not require the caller to pass
`offset_encoding`, which is invalid.
* https://github.com/neovim/neovim/issues/25272
Solution:
* Mark `vim.lsp._get_offset_encoding()` as `@deprecated`.
* Change the type annotations of `vim.lsp.util.make_position_params()`,
`vim.lsp.util.make_range_params()`, `vim.lsp.util.make_given_range_params()`
to require the `offset_encoding` param.
Problem: filetype: openCL files are not recognized
Solution: detect '*.cl' files as opencl or lisp filetype,
include a opencl syntax and filetype plugin (Wu, Zhenyu)
closes: vim/vim#15825e2c27ca8ef
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Problem: filetype: karel files are not detected
Solution: detect '*.kl' files as karel filetype,
include syntax and filetype plugin
(Kirill Morozov)
closes: vim/vim#16075fdac54d7bb
Co-authored-by: Kirill Morozov <kirill@robotix.pro>
Co-authored-by: KnoP-01 <knosowski@graeffrobotics.de>
Problem:
Capability register logic is spread across 3 files.
Solution:
- Consolidate (and simplify) logic into the client.
- Teach client.supports_method about resolve methods
Problem: Not possible to only set a "redraw later" type with
nvim__redraw, which seems to be desired for the
treesitter highlighter.
Solution: Do not update the screen when "flush" is explicitly set to
false and only redraw later types are present. In that case,
do not call ui_flush() either.
**Problem:** Despite the LSP providing the option for language servers
to specify a range with a hover response (for highlighting), Neovim does
not give the option to highlight this range.
**Solution:** Add an option to `buf.hover()` which causes this range to
be highlighted.
Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
Problem: nvim__redraw's "range" marks a buffer range for redraw, and subsequently
flushes the UI without updating the windows containing that buffer.
Solution: Implicitly update the screen, unless specified otherwise.
Only update the screen with the last call of the treesitter
on_changedtree() callback.
Problem: Separate message emitted for each newline present in Lua
print() arguments.
Solution: Make msg_multiline() handle NUL bytes. Refactor print() to use
msg_multiline(). Refactor vim.print() to use print().
Problem: Treesitter highlighter implements an on_bytes callback that
just re-marks a buffer range for redraw. The edit that
prompted the callback will already have done that.
Solution: Remove redundant on_bytes callback from the treesitter
highlighter module.
Problem: Documentation for "hl_group" in nvim_buf_set_extmark() is
unclear. "hl_group" in nvim_echo() does not accept
highlight group id.
Solution: Move documentation for highlight group name/id to first
mention of hl_group. Update nvim_echo() to accept highlight
group id.
Problem: Floating windows with focusable set to false can reasonably be
expected to be UI elements but are listed in some outputs that
should contain only regular windows.
Solution: Hide unfocusable floating windows from the default tabline and
:tabs.
Problem: No longer able to show prompt messages with vim.ui_attach().
Solution: Do not execute callback in fast context for prompt message
kinds. These events must be safe to show the incoming message
so the event itself serves to indicate that the message
should be shown immediately.
Problem: When there is a tree view opened by :InspectTree and the
source buffer is open in multiple windows, closing one of the source
windows will lead to the tree view being closed as well.
Regression by #31181.
Solution: Check how many source windows are open when trying to
quit one. If there are more than one, keep the tree view(s) open.
If the only source window is closed, also close the tree view(s).
fix#31196
Problem: message history is fixed to 200
Solution: Add the 'msghistory' option, increase the default
value to 500 (Shougo Matsushita)
closes: vim/vim#160484bd9b2b246
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Co-authored-by: Milly <milly.ca@gmail.com>
Problem: Lua callbacks for "msg_show" events with vim.ui_attach() are
executed when it is not safe.
Solution: Disallow non-fast API calls for "msg_show" event callbacks.
Automatically detach callback after excessive errors.
Make sure fast APIs do not modify Nvim state.
Problem: Quitting source buffer for ```:InspectTree``` command raises
```E855``` when source buffer and tree views are the only open buffers.
Solution: Add ```QuitPre``` event to autocmd handling closing/hiding the
source buffer to close all open tree views. This allows nvim to quit
when source and tree buffers are the only open windows.
This changes the type for the sorted pattern table from
`vim.filetype.mapping[]` to `vim.filetype.mapping.sorted[]`
E.g. instead of:
```lua
{
{ ['/debian/changelog$'] = {'debchangelog', { parent = '/debian/' } },
{ ['%.git/'] = { detect.git , { parent = 'git/', priority = -1 } },
}
```
It is now:
```lua
{
{ '/debian/, '/debian/changelog$', 'debchangelog' },
{ 'git/' , '%.git/' , detect.git , -1 },
}
```
Overall this should roughly cut the amount of tables used by 3, and
replaces lots of hash indexes with array indexes.
Problem: filetype: leo files are not recognized
Solution: detect '*.leo' files as leo filetype, include
a filetype plugin (Riley Bruins)
References:
https://github.com/ProvableHQ/leocloses: vim/vim#1598893f65a4ab8
Co-authored-by: Riley Bruins <ribru17@hotmail.com>
Problem:
There are three different ways of marking an option as hidden, `enable_if
= false`, `hidden = true` and `immutable = true`. These also have different
behaviors. Options hidden with `enable_if = false` can't have their value
fetched using Vim script or the API, but options hidden with `hidden = true` or
`immutable = true` can. On the other hand, options with `hidden = true` do not
error when trying to set their value, but options with `immutable = true` do.
Solution:
Remove `enable_if = false`, remove the `hidden` property for options, and use
`immutable = true` to mark an option as hidden instead. Also make hidden option
variable pointers always point to the default value, which allows fetching the
value of every hidden option using Vim script and the API. This does also mean
that trying to set a hidden option will now give an error instead of just being
ignored.
Problem: The window opened :InspectTree or :EditQuery isn't closed when
the source buffer is unloaded, even though it is closed when
the buffer is hidden.
Solution: Also close the window on BufUnload.
Problem: 'findexpr' can't be used for lambads
(Justin Keyes)
Solution: Replace the findexpr option with the findfunc option
(Yegappan Lakshmanan)
related: vim/vim#15905closes: vim/vim#15976a13f3a4f5d
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: Long lists of available parsers make it hard to see WASM
status.
Solution: Add separate headings for "treesitter features" (ABI, WASM)
and "treesitter parsers". Also add minimum supported ABI version.
Problem: filetype: sway files are not recognized
Solution: detect '*.sw' files as sway filetype, include
a filetype plugin (Riley Bruins)
References:
https://github.com/FuelLabs/sway.
Comments taken from their syntax documentation. File extension taken
from the same documentation/GitHub's own recognition of these file types
closes: vim/vim#1597384b5b1c660
Co-authored-by: Riley Bruins <ribru17@hotmail.com>
- Partition the handlers in vim.lsp.handlers as:
- client to server response handlers (RCS)
- server to client request handlers (RSC)
- server to client notification handlers (NSC)
Note use string indexes instead of protocol.methods for improved
typing in LuaLS (tip: use hover on RCS, RSC or NSC).
`-NonInteractive` at least somewhat hints to pwsh/powershell, that shell
sessions created from :! are not interactive, though even that is not
foolproof, because powershell is weird.
`$PSStyle.OutputRendering='plaintext'` causes pwsh/powershell
to omit ANSI escape sequences in its output.
Problem: 'findexpr' completion doesn't set v:fname to cmdline argument.
Solution: Set v:fname to the cmdline argument as-is (zeertzjq).
closes: vim/vim#1593420e045f781