Problem: Paging keys being consumed without obvious indicator
in the dialog window can be surprising.
Solution: Display a hint with paging keys in the dialog window title
when paging is active. Recognize <Esc> as mapping to stop
paging.
Problem: vim.on_key() called for each message while cmdline is open.
Cursor is on a seemingly random column when pager is entered.
Entering the pager while the cmdline is expanded can be more
convenient than pressing "g<".
Pager window is unnecessarily clamped to half the shell height.
Setting 'laststatus' while pager is open does not adjust its
dimensions.
Solution: Only call vim.on_key() once when dialog window is opened.
Ensure cursor is at the start of the first message when
entering the pager.
Enter the pager window when "<CR>" is pressed while the
cmdline is expanded.
Don't clamp the pager window height.
Set message windows dimensions when 'laststatus' changes.
Problem: items() does not work for Blobs
Solution: Extend items() to support Blob
(Yegappan Lakshmanan).
closes: vim/vim#18080da34f84847
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
- ':!' is not stable, so use system() to get more consistent behaviour.
- Only warns when using 'pwsh'.
- Remove trailing spaces.
closes: vim/vim#19370abac1c1aa6
Co-authored-by: Mao-Yining <mao.yining@outlook.com>
Co-Authored-by: @lxhillwind
Remove `nextgroup=shComment` from the `shEscape` syntax pattern.
This was causing `#` characters after escape sequences inside
double-quoted strings to be misinterpreted as comments, breaking
highlighting for the rest of the file.
Add a test case for escaped characters followed by # in double quotes.
fixes: vim/vim#19053closes: vim/vim#19414c68e64dac3
Co-authored-by: Bozhidar Batsov <bozhidar@batsov.dev>
**Problem:** No easy way to stack highlight groups #35806.
**Solution:** Add a way to specify a new statusline chunk with a
highlight group that inherits from previous highlight attributes.
Also applies to tabline, etc.
The [spec for `workspace/configuration`](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_configuration)
marks the `section` property of each item in `items` optional.
Therefore, I believe it violates the spec to skip over items without
a section, because then the length of the results won't match the length
of a valid `items` input. The spec does not elaborate on _what_ to
return in this case, but I don't think it would be controversial to say
that returning the full configuration, as done for an empty string, is
the most natural interpretation.
That empty string case, by the way, was initially [added in
response](5da124fc82)
to a real world implementation requesting it. I don't have a similar
real world implementation to point to for the omitted `section`, but
I would note that `getConfiguration()` from `vscode-languageserver-node`
[defaults to a request with no section](d859bb14d1/server/src/common/configuration.ts (L24-L26))
when called with no arguments. I surmise that this is intended as a way
to retrieve the full configuration.
Problem:
When quitting Nvim, LSP servers will not be force-stopped, even if
ClientConfig.exit_timeout is set to an integer.
pkill emmylua_ls; VIMRUNTIME=runtime/ nvim --clean -u repro.lua repro.lua ; waitpid $(pgrep emmylua_ls)
vim.lsp.config('foo', { cmd = { 'emmylua_ls' }, exit_timeout = 1000 })
vim.lsp.enable('foo')
vim.defer_fn(vim.cmd.quit, 500)
Solution:
On VimExit, wait up to `exit_timeout:integer` milliseconds for servers
to exit. Do this with an explicit `vim.wait()`, because the actual
force-stop is deferred, and won't be attempted if Nvim exits before
then.
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
- Refactor LSP client to use unified provider-based capability lookup for
diagnostics and other features.
- Introduce `_provider_value_get` to abstract capability retrieval,
supporting both static and dynamic registrations.
- Update diagnostic handling and protocol mappings to leverage
provider-centric logic.
Problem: Executing `nvim_buf_delete()` does not guarantee that the
window which shows the buffer is going to close after `:write` or
`:quit`. In particular, if there is no listed buffer present.
Solution: Explicitly close the window that was created for confirmation
buffer. Use `pcall` to catch cases when the window was already closed
or when it is the last window.
Problem:
`vim.diagnostic.fromqflist` ignores lines that are `item.valid == 0` (see
`getqflist`). Many qflists have messages that span multiple lines, which look
like this:
collection/src/Modelling/CdOd/Central.hs|496 col 80| error: [GHC-83865]
|| • Couldn't match expected type: InstanceWithForm
|| (FilePath
|| -> SelectValidCdInstWithForm
...
calling `vim.diagnostic.fromqflist(vim.fn.getqflist)` gets a diagnostic message
like this:
error: [GHC-83865]
only the first line is kept, but often, the remaing lines are useful as well.
Solution:
Introduce `merge_lines` option, which "squashes" lines from invalid qflist items
into the error message of the previous valid item, so that we get this
diagnostic message instead:
error: [GHC-83865]
• Couldn't match expected type: InstanceWithForm
(FilePath
-> SelectValidCdInstWithForm
Problem:
- `:restart <cmd>` prepends `-c <cmd>` before the original `-c` args (if
any). So the original `-c` args may "override" it, which is
surprising.
- Confusing logic: `v:argv` is partially prepared in `ex_docmd.c`, and
then later `ui.c` skips other parts of it.
Current behavior is nonsense, for example this sequence:
:restart echo "Hello"
:restart +qall echo "Hello" | echo "World"
results in this v:argv:
[
'nvim'
'-c'
'echo "Hello" | echo "World"'
'--embed'
'-c'
'echo "Hello"'
...
]
Whereas after this commit, v:argv is:
[
'nvim'
'--embed'
...
'-c'
'echo "Hello" | echo "World"'
]
Solution:
- Append `-c <cmd>` at the _end_ of `v:argv`, not the start.
- Use a dummy placeholder `+:::` to mark where the "restart command"
appears in `v:argv`.
- Do all `v:argv` preparation in `ex_docmd.c`. This simplifies `ui.c`.
- Drop `-- [files…]` from `v:argv` since it is probably more annoying
than useful. (Users can use sessions to restore files on restart.)
Problem:
- ~200 line function of hard-to-maintain C code.
- Local Addition section looks messy because of the varying description
formats.
Solution:
- Move code to Lua.
- Have a best-effort approach where short descriptions are right
aligned, giving a cleaner look. Long descriptions are untouched.
Effective use of 'formatprg' requires both an understanding of the
specific capabilities of the formatting tool and Vim's formatting
commands. This is overly burdensome for some users.
Rather than address each complaint on a filetype by filetype basis,
remove 'formatprg' settings from all ftplugins.
It is expected that formatter plugins will be available in the near
future as a better solution. See vim/vim#17145 (Add "formatter" feature using
"compiler" as a template).
Note: 'formatprg' will be removed from older ftplugins after the release
of Vim 9.2. The setting was added to the go and gleam ftplugins during
the current development cycle and have not been included in a Vim
release.
See: vim/vim#18650 (rust.vim: stop setting formatprg to rustfmt)
closes: vim/vim#19108dcc4175284
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
The username/group/netgroup patterns used \l\+ which only matched
lowercase letters. Linux usernames commonly contain hyphens, digits,
and underscores (e.g. www-data, deploy01, test_user).
Update the pattern to \l[-a-z0-9_]* to allow matching the additional
characters "-_" and numbers.
fixes: vim/vim#18963closes: vim/vim#19396a39d7c2617
Co-authored-by: Bozhidar Batsov <bozhidar@batsov.dev>
Problem: Terminal doesn't detect if the PTY process is suspended or
offer a convenient way for the user to resume the process.
Solution: Detect suspended PTY process on SIGCHLD and show virtual text
"[Process suspended]" at the bottom-left. Resume the process
when the user presses a key.
- Amend syntax highlighting to allow for ksh93 discipline function names
(e.g. 'foo.get()') and mksh's odd function naming idiosyncrasies
(shNamespaceOne was introduced to enforce stricter naming rules for
ksh93 namespaces).
- Remove 'bind' from ksh93 syntax (such a builtin has never been
implemented in ksh93).
- 'xgrep' is only available in ksh93v- as an alternative way to
invoke the builtin 'grep -X', so reflect that in the syntax
highlighting.
- Forbid bash-style 'function name() {' syntax when highlighting
ksh88 and ksh93 scripts.
- Fix bug causing ' ()' to be incorrectly validated in mksh scripts.
- Add the many ksh93/ksh2020 .sh.* variables to the list of special
variables.
- Amend iskeyword to allow '.' so that '.sh.tilde.get' and such are
valid function names/variable names. (For mksh functions starting
with odd characters like '%' and '@' this would probably have too
many bad side effects, so I've omitted such a change for that shell.)
- Add new syntax tests and regenerate syntax dump files
closes: vim/vim#1938356033b9df3
Co-authored-by: Johnothan King <johnothanking@protonmail.com>
We add new key exchange algorithms and new enums for PubkeyAuthOptions.
We also add new keywords from sshd_config.5 not present here and remove
keywords present here that are not present in the official
documentation, with the exception of those patched in by Debian and
Fedora, as well as ChallengeResponseAuthentication which is deprecated
but still functional.
closes: vim/vim#1934704c3c6871e
Co-authored-by: Fionn Fitzmaurice <fionn@github.com>
Problem:
Iter:peek() only works if the iterator is a |list-iterator| (internally, an `ArrayIter`).
However, it is possible to implement :peek() support for any iterator.
Solution:
- add `_peeked` buffer for lookahead without actually consuming values
- `peek()` now works for function, pairs(), and array iterators
- `skip(predicate)` stops at the first non matching element without consuming it
- keep existing optimized behavior for `ArrayIter` to maintain backward compatibility
- use `pack`/`unpack` to support iterators that return multiple values
fix(treesitter): more distinctive highlight for EditQuery captures
Problem: EditQuery shows captures in the source buffer using the Title
highlight group, which could be too similar to Normal.
Solution: Use a virtual text diagnostic highlight group: they are
displayed in a similar manner to the query captures so we can assume
that the color scheme should have appropriate styling applied to make
them visible.
Problem:
`vim.json.decode()` could not parse JSONC (JSON with Comments)
extension, which is commonly used in configuration files.
Solution:
Introduce an `skip_comments` option, which is disabled by default. When
enabled, allows JavaScript-style comments within JSON data.