Problem: Legacy :sign API still allows placing signs beyond the end of
the buffer. This is unaccounted for by the signcolumn tracking
logic and is disallowed in general for the extmark API which
implements it now.
Solution: Clamp legacy sign line number to the length of the buffer.
(cherry picked from commit 1dcda86559
extmark_set() namespace scope and screen test reverse sign order conflict)
fix(tui): move $COLORTERM check to _defaults.lua (#29197)
We currently check $COLORTERM in the TUI process to determine if the
terminal supports 24 bit color (truecolor). If $COLORTERM is "truecolor"
or "24bit" then we automatically assume that the terminal supports
truecolor, but if $COLORTERM is set to any other value we still query
the terminal.
The `rgb` flag of the UI struct is a boolean which only indicates
whether the UI supports truecolor, but does not have a 3rd state that we
can use to represent "we don't know if the UI supports truecolor". We
currently use `rgb=false` to represent this "we don't know" state, and
we use XTGETTCAP and DECRQSS queries to determine at runtime if the
terminal supports truecolor. However, if $COLORTERM is set to a value
besides "truecolor" or "24bit" (e.g. "256" or "16) that is a clear
indication that the terminal _does not_ support truecolor, so it is
incorrect to treat `rgb=false` as "we don't know" in that case.
Instead, in the TUI process we only check for the terminfo capabilities.
This must be done in the TUI process because we do not have access to
this information in the core Neovim process when `_defaults.lua` runs.
If the TUI cannot determine truecolor support from terminfo alone, we
set `rgb=false` to indicate "we don't know if the terminal supports
truecolor yet, keep checking". When we get to `_defaults.lua`, we can
then check $COLORTERM and only query the terminal if it is unset.
This means that users can explicitly opt out of truecolor determination
by setting `COLORTERM=256` (or similar) in their environment.
(cherry picked from commit d7651b27d5)
Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
LspDetach is now triggered by the main on_detach callback that is added
when an LSP client is attached to a buffer. The semantic_tokens module
already includes a LspDetach handler that does the right thing. When the
LspDetach trigger was added to the main LSP on_detach, it created a race
condition in semantic tokens when a buffer was deleted that would
trigger both its own on_detach and the LspDetach handlers. If the former
came last, an error was thrown trying to delete a non-existent augroup
(destroy() was being called twice).
(cherry picked from commit 43581011e4)
Co-authored-by: jdrouhard <john@drouhard.dev>
Problem: Unsetting global variables earlier in #28578 to avoid
recursiveness, caused superfluous or even unlimited
showmode().
Solution: Partly revert #28578 so that the globals are unset at the end
of showmode(), and avoid recursiveness for ext UI by adding a
recursive function guard to each generated UI call that may
call a Lua callback.
(cherry picked from commit b66106a46c)
Problem: Text properties wrong when tabs and spaces are exchanged.
Solution: Take text properties into account. (Nobuhiro Takasaki,
closesvim/vim#5427)
5cb0b93d52
Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit 4374ec83cd)
Problem: Numberwidth may depend on number of signs with text in the
buffer and is not handled correctly for extmark signs.
Solution: Move legacy sign code for changed numberwidth so that it is
handled properly for legacy and extmark signs alike.
(cherry picked from commit f2083bd55c)
#22856 made it possible for the msi installer to perform per-user
installations, which caused problems for users that already had
per-machine installations trying to update (the Windows Installer does
not support major upgrades across installation context, see #22933 and
https://stackoverflow.com/a/15498911). It was then reverted in #22949,
but the scope of the modification to the PATH environment variable was
not reverted.
(cherry picked from commit a18652ed61)
Problem: When an lsp client is stopped, the client will
only clear the diagnostics for the attached buffers but
not the unattached buffers.
Solution: Reset the diagnostics for the whole namespace rather than
for only the attached buffers.
(cherry picked from commit 025c874415)
Co-authored-by: crwebb85 <51029315+crwebb85@users.noreply.github.com>
Problem: Unable to update the screen for external cmdline during cmdpreview.
Solution: Flush the cmdline UI before cmdpreview state.
(cherry picked from commit 5b6477be45)
Co-authored-by: luukvbaal <luukvbaal@gmail.com>
On Windows, '{' is currently not treated as a wildcard char, so another
wildcard char is needed for the pattern to be treated as a wildcard.
It may be worth trying to make '{' always a wildcard char in the future,
but that'll be a bit harder as it'll be necessary to make sure '{' is
escaped at various places.
(cherry picked from commit 7b16c1fa84)
Problem: if on_lines is called before the LSP is initialized, the buffer
is detached.
Solution: check for uninitialized clients before detaching.
(cherry picked from commit 292365fa1b)
Co-authored-by: Ilia Choly <ilia.choly@gmail.com>
Problem:
NetBSD's libc already has a function by the same name.
Solution:
Rename popcount to xpopcount and add #if defined(__NetBSD__) to
prefer NetBSD's own implementation. This fixes#28983.
(cherry picked from commit 104800ce2e)
Problem: Invalid marks appear to be revalidated multiple times, and
decor is added at the old position for unpaired marks.
Solution: Avoid revalidating already valid marks, and don't use old
position to add to decor for unpaired marks.
(cherry picked from commit 43a2019f09)
fix(lsp): handle nil root_dir in health check (#29007)
The root directory could show up as something like:
Root directory: ~/path/to/cwd/v:null
Despite being `nil`
(cherry picked from commit f03b1622ad)
Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
docs: update LSP quickstart (#28954)
The LSP quickstart can act as our true "entrypoint" for answering the
question "How do I use LSP in Neovim?" As such, it can be a little more
beginniner-friendly than other sections of our help docs by including
explanatory comments and a more fleshed out example (including a
`FileType` autocommand).
This also includes some other minor wording updates and points users
toward `:checkhealth lsp`.
(cherry picked from commit 28c04948a1)
Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
feat(lsp): update LSP healthcheck format (#28980)
This is mostly an aesthetic change, although there are a few new pieces
of information included. Originally I wanted to investigate including
server capabilities in the healthcheck, but until we have the ability to
fold/unfold text in health checks that would be too much information.
(cherry picked from commit 5d26934c7c)
Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
The new default SwapExists autocommand displays warning text (W325) but
does not use the WarningMsg highlight group as other warnings do. Use
the WARN log level when displaying this warning.
(cherry picked from commit e71713ba2b)
fix(comment): fall back to using trimmed comment markers (#28938)
Problem: Currently comment detection, addition, and removal are done
by matching 'commentstring' exactly. This has the downside when users
want to add comment markers with space (like with `-- %s`
commentstring) but also be able to uncomment lines that do not contain
space (like `--aaa`).
Solution: Use the following approach:
- Line is commented if it matches 'commentstring' with trimmed parts.
- Adding comment is 100% relying on 'commentstring' parts (as is now).
- Removing comment is first trying exact 'commentstring' parts with
fallback on trying its trimmed parts.
(cherry picked from commit 0a2218f965)
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Problem: statusline for non-active window can be hard to distinguish
from normal text with 'notermguicolors'. It was set to use only bold
text to find a balance between being not too similar to active
statusline and normal text, and be supported in enough terminal
emulators (if it does not support 'termguicolors' there is higher
chance that it also does not support underline).
Solution: reconsider balance by placing more emphasis on making
non-active statusline more distinguishable.
This also results into tabline being shown with underline which
aligns with "make more distinguishable" shift.
(cherry picked from commit 9b9f54e2c1)
Problem: The changetracking state can de-sync when reloading a buffer
with more than one LSP client attached.
Solution: Fully detach all clients from the buffer to force buf_state to
be re-created.
(cherry picked from commit 879d17ea8d)
Co-authored-by: Ilia Choly <ilia.choly@gmail.com>
Problem: layout i.e. whitespace that is part of codelenses is currently
displayed as weird symbols and large amounts of spaces
Solution: replace all consecutive whitespace symbols with a single space
character when trying to display codelenses as virtual text
(cherry picked from commit d9a2acdab3)
Co-authored-by: Mango The Fourth <40720523+MangoIV@users.noreply.github.com>