Problem: Currently, vim.notify is only used to display messages when the
message type is Error.
Solution: Use vim.notify to display messages for all message types.
Problem: The "append" parameter added in abb40ece is missing from
history entries, resulting in different message formatting
for "g<".
Solution: Add "append" field to message history entries.
Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
Problem: Cmdline buffer is not cleared for a new message (since c973c7ae),
resulting in an incorrect spill indicator. When the cmdline
buffer is cleared, "msg_row" is not invalidated, resulting in
an error. The extui module is untested.
Return value of `vim.ui_attach()->callback` is undocumented.
Solution: Clear the cmdline buffer for the first message in an event
loop iteration. Ensure msg_row passed as end_row does not
exceed buffer length.
Add `messages_spec2.lua` to test the extui module, keeping in
mind that test coverage will greatly increase if this UI is made
the default. As such, only tests for specific extui functionality
unlikely to be covered by tests leveraging the current message grid.
Document the return value of `vim.ui_attach()->callback`, it seems
to make sense, and is also used to suppress remote UI events in
`messages_spec2.lua`.
This commit changes the `offset!` directive so that instead of setting a
`metadata.range` value for the entire pattern, it will set a
`metadata.offset` value. This offset will be applied to the range only
in `vim.treesitter.get_range()`, rather than at directive application
time. This allows the offset to be applied to any and all nodes captured
by the given pattern, and removes the requirement that `#offset!` be
applied to only a single node.
The downside of this change is that plugins which read from
`metadata.range` may be thrown off course, but such plugins should
prefer `vim.treesitter.get_range()` when retrieving ranges anyway.
Note that `#trim!` still sets `metadata.range`, and
`vim.treesitter.get_range()` still reads from `metadata.range`, if it
exists.
Problem: 8defe1a declared the "more" window the most convenient place to
route messages to if it is already open for msg.pos == 'cmd'.
In usage, this doesn't appear to be the case. Appending messages
as added in that commit is still useful, but should only be done
for messages that spill 'cmdheight'.
Solution: Only append messages exceeding 'cmdheight' to the more window.
To do this, instead of immediately writing to the more buffer,
write to the cmd buffer and calculate its height. Then copy the
text and its highlights to the more buffer.
Replace direct function mappings with `<Plug>` mappings for cycling
through overloaded signatures, providing better customization options
for users. This change keeps the default mapping (`<C-s>`) for cycling
if `<Plug>(nvim.lsp.ctrl-s)` is not mapped.
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`.
Before this commit, I had trouble finding information about configuring
the insert mode completion. In particular, it was not clear that the
'wildopt' config that I already had in my vimrc does not apply here.
Also, `insert.txt` barely mentioned 'completeopt' except when
describing popups (I was more interested in bash-like behavior
where the unique prefix of all completions is completed first).
I'm hoping these edits will make the relevant docs easier to find.
closes: vim/vim#17515053aee01f7
Co-authored-by: Ilya Grigoriev <ilyagr@users.noreply.github.com>
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>
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.
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`.
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)
```
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.
**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: 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).
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.
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).
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.
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.
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#17347closes: vim/vim#1737814f6da5ba8
Co-authored-by: Girish Palya <girishji@gmail.com>