This commit also implements more generic trimming, acting on all
whitespace (charwise) rather than just empty lines.
It will unblock
https://github.com/nvim-treesitter/nvim-treesitter/pull/3442 and allow
for properly concealing markdown bullet markers regardless of indent
width, e.g.
Problem: When completion leader changes, text that might be reinserted
immediately after is deleted. This unnecessarily affects
extmarks. #31387 restored the original extmarks but that
prevents end_right_gravity marks from growing.
Solution: Avoid deleting leader text that will be reinserted.
Problem: In an autocommand Lua callback whether `args.file` is expanded
depends on whether `expand('<afile>')` has been called.
Solution: Always use the unexpanded file name for `args.file`.
Related to #31306 and vim/vim#16106. This doesn't provide `sfname`, but
at least makes `args.file` have a consistent value.
Problem: Marks that are properly restored by the splice associated with
an undo edit, are unnecessarily pushed to the undo header. This
results in incorrect mark tracking in the "copy_only"
save/restore completion path.
Solution: Avoid pushing left gravity marks at the beginning of the range,
and right gravity marks at the end of the range to the undo
header.
Problem: Missing information in CompleteDone event
Solution: add complete_word and complete_type to v:event dict
(glepnir)
closes: vim/vim#161531c5a120a70
Problem: filetype: Conda configuration files are not recognized
Solution: detect '.condarc' and 'condarc' files as yaml filetype.
(zeertzjq)
closes: vim/vim#16162876de275cb
In release builds, the Compilation: line is omitted so the build is reproducible. Since the "fall-back for $VIM" line is always present, check for that instead.
In order to run unittests with a release build, we need the test
functions to be accessible when NDEBUG is defined. Moving the functions
into the test fixture ensures they are available and only available for
use by the unit tests.
Problem:
- nvim_subscribe, nvim_unsubscribe were deprecated in
aec4938a21 but this wasn't set in the
API metadata.
- The function annotations
```
FUNC_API_SINCE(1) FUNC_API_REMOTE_ONLY FUNC_API_DEPRECATED_SINCE(13)
```
cause this test to fail:
```
RUN T3 api metadata functions are compatible with old metadata or have new level: 3.00 ms ERR
test/functional/api/version_spec.lua:135: function vim_subscribe was removed but exists in level 0 which nvim should be compatible with
stack traceback:
test/functional/api/version_spec.lua:135: in function <test/functional/api/version_spec.lua:128>
```
Solution:
- Set the API metadata.
- Rearrange the annotations so that FUNC_API_DEPRECATED_SINCE is 2nd:
```
FUNC_API_SINCE(1) FUNC_API_DEPRECATED_SINCE(13) FUNC_API_REMOTE_ONLY
```
Problem: default for 'backspace' can be set in C code
Solution: promote the default for 'backspace' from defaults.vim to the C
code (Luca Saccarola)
closes: vim/vim#16143959ef61430
N/A patches:
vim-patch:9.1.0895: default history value is too small
vim-patch:075aeea: runtime(doc): document changed default value for 'history'
Co-authored-by: Luca Saccarola <github.e41mv@aleeas.com>
Problem: runtime(compiler): pytest compiler not included
Solution: include pytest compiler, update the compiler completion test
(Konfekt)
closes: vim/vim#161303c2596a9e9
Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
Problem: completion list wrong after v9.1.0891
Solution: update compl_mach_array after leader change
(glepnir)
compl_shown_match update not correct after refactoring in v9.1.0891
Unfortunately, this regressed what item is selected after leader change.
So generate compl_match_array before updating compl_shown_match range,
and split generate compl_match_array into range match_head
fixes: https://github.com/vim/vim/issues/16128
closes: https://github.com/vim/vim/pull/16129a49c077a88
* 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 max value of 'cmdheight' is limited by other tabpages
Solution: Limit the maximum value of 'cmdheight' to the current tabpage only.
(Milly)
The Help says that cmdheight is local to the tab page, but says nothing
about the maximum value depending on the state of all tab pages. Users
may wonder why they can't increase cmdheight when there are still rows
available on the current tab page. This PR changes the behavior of
cmdheight so that its maximum value depends only on the state of the
current tab page.
Also, since magic numbers were embedded in various places with the
minimum value of cmdheight being 1, we defined a constant to make it
easier to understand.
closes: vim/vim#161312cddf0e85a
Cherry-pick Test_cmdheight_not_changed() from patch 9.0.0187.
Co-authored-by: Milly <milly.ca@gmail.com>
Problem: 'fileencodings' default value should depend on 'encoding'. (Gary
Johnson)
Solution: When 'encoding' is "utf-8" use a different default value for
'fileencodings'.
5ffefbb35a
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: No test for what the spotbug compiler parses
(after commit: 65311c6f472de67b368)
Solution: Test &makeprg for the SpotBugs compiler plugin
(Aliaksei Budavei)
closes: vim/vim#1609660ddb1a140
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
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:
`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: Hit double grid_line_start() assert when redrawing from
ext_messages msg_ruler event.
Solution: Do not start() batched grid calls when win_redr_ruler() will not
puts() anything.
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:
`validate_option_value_args()` returns `OK` even if option name is
invalid or if option doesn't have the supported scope, which leads to
Neovim still trying to erroneously get/set the option in those cases,
which can lead to an assertion failure when `option_has_scope()` is
invoked. This issue miraculously doesn't exist in release builds since
the assertion is skipped and `(get/set)_option_value_for` returns if
there is an error set, but that is not the intended location for that
error to be caught.
Solution:
Make `validate_option_value_args()` return `FAIL` if there is an error
set, which causes the API option functions to return early instead of
trying to get/set an invalid option.
The newer UCRT runtime has native support for UTF-8, including forcing
it as the active codepage even before `main()` is called. This means
the c runtime will properly convert windows WCHAR:s into UTF-8 bytes,
as early as the argv/argc params to `main()` . Whereas MSVCRT does not
support this reliably and required us to use `wmain()`.
Only MSVC supports using manifest files directly as source files.
The solution for other Windows toolchains is to use a .rc file.
By making it a separate module, the embedded Nvim session can require
this module directly instead of setup code sending over the module via
RPC.
Also make exec_lua wrap _G.print so messages can be seen
in the test output immediately as the exec_lua returns.
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: curswant not set on gm in folded line
(citizenmatt)
Solution: in a folded line, call update_curswant_force()
fixes: vim/vim#11596closes: vim/vim#11994closes: vim/vim#153989848face74
Co-authored-by: Christian Brabandt <cb@256bit.org>
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: 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: setting 'cmdheight' may cause hit-enter-prompt and echo output
to be missing
Solution: Before cleaning the cmdline, check the need_wait_return flag
(nwounkn)
closes: vim/vim#134322e48567007
Co-authored-by: nwounkn <nwounkn@gmail.com>
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.
Before calling "attach" a screen object is just a dummy container for
(row, col) values whose purpose is to be sent as part of the "attach"
function call anyway.
Just create the screen in an attached state directly. Keep the complete
(row, col, options) config together. It is still completely valid to
later detach and re-attach as needed, including to another session.
**Problem:** Currently node names with non-alphanumeric, non
underscore/hyphen characters (only possible with anonymous nodes) are
not given a proper error message. See tree-sitter issue 3892 for more
details.
**Solution:** Apply a different scanning logic to anonymous nodes to
correctly identify the entire node name (i.e., up until the final double
quote)
Problem: Crash when initializing for --startuptime errors.
Solution: Report the error to stderr, as neither logging nor messages
have been initialized yet.
Problem: Ext_messages chunks only contain the highlight attr id, which
is not very useful for vim.ui_attach() consumers.
Solotion: Add highlight group id to message chunks, which can easily be
used to highlight text in the TUI through nvim_buf_set_extmark():
hl_group = synIDattr(id, "name").
Problem: Highlight group id is not propagated to the end of the message call
stack, where ext_messages are emitted.
Solution: Refactor message functions to pass along highlight group id
instead of attr id.
Problem: Inccommand preview callback may flush inaccurate cmdline cursor position.
Solution: Ensure cursor is where it belongs when doing command preview.