Problem:
jobwait() returns early if the job was stopped, but the job might have
pending callbacks on its event queue which are required to complete its
teardown. State such as term->closed might not be updated yet (by the
pending callbacks), so codepaths such as :bdelete think the job is still
running.
Solution:
Always flush the job's event queue before returning from jobwait().
ref #15349
Co-authored-by: Gregory Anders <greg@gpanders.com>
- not necessary on master: got lost in the vim.lsp.diagnostic => vim.diagnostic migration
- fix tests which accidentally depended on previous session
- ref #15504
According to the protocol definition `rootPath`, `rootUri` and
`workspaceFolders` are allowed to be null.
Some language servers utilize this to provide "single file" support.
If all three are null, they don't attempt to index a directory but
instead only provide capabilities for a single file.
Some language servers *cough*rust-analyzer*cough* need an empty/custom
workspaceFolders for certain usecases. For example, rust-analyzer
needs an empty workspaceFolders table for standalone file support
(See https://github.com/rust-analyzer/rust-analyzer/pull/8955).
This can also be useful for other languages that need to commonly
open a certain directory (like flutter or lua), which would help
prevent spinning up a new language server altogether.
In case no workspaceFolders are passed, we fallback to what we had
before.
ipairs terminates on the first nil index when iterating over table keys:
for i,k in ipairs( {[1] = 'test', [3] = 'test'} ) do
print(i, k)
end
prints:
1 test
Instead, use pairs which continues iterating over the entire table:
for i,k in pairs( {[1] = 'test', [3] = 'test'} ) do
print(i, k)
end
prints:
1 test
3 test
* Simplify rpc encode/decode messages to rpc.send/rcp.receive
* Make missing handlers message throw a warning
* Clean up formatting style in log
* Move all non-RPC loop messages to trace instead of debug
* Add format func option to log to allow newlines in per log entry
This fixes the handler signature and also prevents n+1 requests firing
if there are multiple clients.
(The first `prepareCallHierarchy` handler is called once per client,
each invocation used `buf_request` to make more requests using *all*
clients)
Resolve an issue with deferred clearing of highlight failing if the
buffer is deleted before the timeout by checking whether the
buffer is valid first.
`return err_message(tostring(err))` caused errors to be printed as
`table: 0x123456789` instead of showing the error code and error
message.
This also removes some `if err` blocks that never got called because at
the end of `handlers.lua` all the handlers are wrapped with logic that
adds generic error handling.
Analogous to nodejs's `on('data', …)` interface, here on_key is the "add
listener" interface.
ref 3ccdbc570d#12536
BREAKING_CHANGE: vim.register_keystroke_callback() is now an error.
Options formatted as a list of comma-separated key-value pairs may have
values that contain leading and trailing whitespace characters. For
example, the `listchars` option has a default value of
`"tab:> ,trail:-,nbsp:+"`. When converting this value to a lua table,
leading and trailing whitespace should not be trimmed.
Co-authored-by: Robert Hrusecky <robert.hrusecky@utexas.edu>
Some programs behave differently when they detect that stdin is being
piped. This can be problematic when these programs are used with the job
control API where stdin is attached, but not typically used. It is
possible to run the job using a PTY which circumvents this problem, but
that includes a lot of overhead when simply closing the stdin pipe would
suffice.
To enable this behavior, add a new parameter to the jobstart options
dict called "stdin" with two valid values: "pipe" (the default)
implements the existing behavior of opening a channel for stdin and
"null" which disconnects stdin (or, if you prefer, connects it to
/dev/null). This is extensible so that other modes can be added in the
future.
Problem:
"set filetype=man" assumes the user wants :Man features, this does extra
stuff like renaming the buffer as "man://".
Solution:
- old entrypoint was ":set filetype=man", but this is too presumptuous #15487
- make the entrypoints more explicit:
1. when the ":Man" command is run
2. when a "man://" buffer is opened
- remove the tricky b:man_sect checks in ftplugin/man.vim and syntax/man.vim
- MANPAGER is supported via ":Man!", as documented.
fixes#15487
Ensure that
* Shell uses UTF8 input/output mode
* Stderr output is captured, in UTF8
* Program exit codes are correctly captured
Update functional test harness and add tests
for :make command.
Closes#13713
Block copy and paste from system-clipboard currently breaks formatting.
This fixes it.
The bug occurs because system-clipboard doesn't contain information
about what mode the copy was made.
Simple solution to this is we keep a cache of copy we last made along
with mode information. If system-clipboard returns the cache we apply
the mode information that we know about that cache.
This closes#14677, but I also am a little unsure if there are times
where this may not be correct. However, this just changes the behavior
that even if `was_set` was false, we still get for
`nvim_win_get_option`.
* Add buffer information to tabline_update
Most terminal implementations of the tabline display buffer and tab
information. Many neovim-qt users disable GuiTabline because it lacks
functionality provided in the terminal implementation.
The tabline_update event should include buffer information too, so client GUIs
can display rich useful tabs.