* str_utfindex checks number of arguments only, but ignores the case in
which the second argument is an explicit nil. Previously this required
dropping the second argument entirely.
* Modify the C binding to explicitly check if the second argument is nil
This allows users to hook into diagnostic events with finer granularity
(e.g. per-buffer or file).
BREAKING CHANGE: DiagnosticsChanged and LspDiagnosticsChanged user
autocommands are removed.
Previously, the built-in language server client checked if the first
argument of cmd was executable via vim.fn.executable. This ignores PATH
injected via cmd_env. Instead, we now start the client via uv.spawn, and
handle the failure mode, reporting the error back to the user.
Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
Floating windows opened by `goto_next` and `goto_prev` should not be
focused when repeating the `goto_` function. The float can still be
focused by calling `open_float` with `scope = "cursor"`.
Reverts 5b0d8f85fd.
Diagnostic producers can send diagnostics for buffers that are not
loaded, for which we cannot retrieve the line count to clamp line
numbers. This means that some diagnostics in the quickfix list could be
line-clamped and others not. The quickfix list can already handle line
numbers past the end of the buffer (i.e. it *already* clamps line
numbers) so just use the "raw" diagnostic positions sent from the
producer.
04bfd20bb introduced a subtle bug where using 0 as the buffer number in
the diagnostic cache resets the cache for the current buffer. This
happens because we were not checking to see if the _resolved_ buffer
number already existed in the cache; rather, when the __index metamethod
was called we assumed the index did not exist so we set its value to an
empty table. The fix for this is to check `rawget()` for the resolved
buffer number to see if the index already exists.
However, the reason this bug was introduced in the first place was
because we are simply being too clever by allowing a 0 buffer number as
the index which is automatically resolved to a real buffer number.
In the interest of minimizing metatable magic, remove this "feature" by
requiring the buffer number index to always be a valid buffer. This
ensures that the __index metamethod is only ever called for non-existing
buffers (which is what we wanted originally) as well as reduces some of
the cognitive overhead for understanding how the diagnostic cache works.
The tradeoff is that all public API functions must now resolve 0 buffer
numbers to the current buffer number.
The phrase referred specifically to `$VIMINIT` and `$EXRC`, which
are parsed (and available with, e.g., `echo $VIMINIT` if set) but
of course not loaded since _any_ initialization is skipped. Hence
this is redundant and can be misleading.
vim-patch:8.2.3627: difficult to know where the text starts in a window
Problem: difficult to know where the text starts in a window. (Sergey
Vlasov)
Solution: Add the "textoff" entry in the result of getwininfo().
(closesvim/vim#9163)
cdf5fdb294
Fix indent in Test_getbufwintabinfo().
Errors were being caused by invalid buffers being kept around in
diagnostic_cache, so add a metatable to diagnostic_cache which attaches
to new buffers in the cache, removing them after they are invalidated.
Closes#16391.
Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
Problem: ci" finds following string but ci< and others don't.
Solution: When not inside an object find the start. (Connor Lane Smit,
closesvim/vim#8670)
b9115da4be
Problem: On a narrow screen ":hi" output is confusing.
Solution: Insert a space between highlight group name and "xxx". (Masato
Nishihaga, closesvim/vim#4599)
548be7f126
Problem: getcompletion() always passes zero as position to custom
completion function.
Solution: Pass the pattern length. (closesvim/vim#9173)
4785fe02bb
Co-authored-by: ii14 <ii14@users.noreply.github.com>
Problem: printf format not checked for semsg().
Solution: Add GNUC attribute and fix reported problems. (Dominique Pelle,
closesvim/vim#3805)
b5443cc46d
(Most of the changes do not apply because Neovim already uses PRId64 and other spelling mistakes were already fixed.)
The current 'clamp_line_numbers' implementation modifies diagnostics in
place, which can have adverse downstream side effects. Before clamping
line numbers, make a copy of the diagnostic. This commit also merges the
'clamp_line_numbers' method into a new 'get_diagnostics' local function
which also implements the more general "get" method. The public
'vim.diagnostic.get()' API now just uses this function (without
clamping). This has the added benefit that other internal API functions
that need to use get() no longer have to go through vim.validate.
Finally, reorganize the source code a bit by grouping all of the data
structures together near the top of the file.
* fix(eval): fixup for empty modifier in fnamemodify
1dbbaf89bf
erroneously removed a check for empty modifier and a PVS fix.
Restore that check and fix.
Fixes#16367
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Problem: "verbose pwd" shows confusing info when :lcd does not change
directory.
Solution: Clear last_chdir_reason also when the directory does not change.
(closesvim/vim#9160)
64be6aa3a5
This only ports the tests, as this is already Nvim's behavior.