Commit Graph

29930 Commits

Author SHA1 Message Date
zeertzjq
dc4037f612 vim-patch:9.1.0476: Cannot see matched text in popup menu
Problem:  Cannot see matched text in popup menu
Solution: Introduce 2 new highlighting groups: PmenuMatch and
          PmenuMatchSel (glepnir)

closes: vim/vim#14694

40c1c3317d

Co-authored-by: glepnir <glephunter@gmail.com>
2024-06-15 04:47:23 +08:00
zeertzjq
fd950d4998
vim-patch:9.1.0484: Sorting of completeopt+=fuzzy is not stable (#29338)
Problem:  Sorting of completeopt+=fuzzy is not stable.
Solution: Compare original indexes when scores are the same.
          (zeertzjq)

closes: vim/vim#14988

8e56747fd2
2024-06-15 04:33:19 +08:00
Mathias Fußenegger
aa47af7e69
fix(lsp): tune completion word extraction for decorated labels (#29331)
Problem:

For snippets lsp.completion prefers the label if it is shorter than the
insertText or textEdit to support postfix completion cases but clangd
adds decoration characters to labels. E.g.: `•INT16_C(c)`

Solution:

Use parse_snippet on insertText/textEdit before checking if it is
shorter than the label.

Fixes https://github.com/neovim/neovim/issues/29301
2024-06-14 19:32:34 +02:00
bfredl
ba70404c55
Merge pull request #29241 from bfredl/shadapack
refactor(shada): use msgpack_sbuffer less
2024-06-14 11:33:27 +02:00
Evgeni Chasnovski
458473acb8
fix(highlight): add StatusLineTerm/StatusLineTermNC to :color vim (#29313)
Problem: both `StatusLineTerm`/`StatusLineTermNC` are now explicitly
  used, but `:color vim` does not set them to the values used in Vim.
  This might be fine if `:color vim` is treated as "the state of default
  color scheme prior the big update", but it seems to be better treated
  as "Vim's default color scheme" (how it is documented in its header).

Solution: add `StatusLineTerm`/`StatusLineTermNC` definitions to
  'runtime/colors/vim.lua'.
  Use explicit foreground colors ('Whte'/'Black') instead of `guifg=bg`
  used in source, as the latter caused some problems in the past (if
  `Normal` is not defined, `nvim_set_hl()` can't recognize `'bg'` as the
  foreground value).
  Also realign the rest of the background conditional highlight groups.
2024-06-14 17:28:49 +08:00
Ilia Choly
0a9c81d709
refactor(lsp): use metatable for buf_versions (#29304)
This reduces the number of nil checks around buf_versions usage
Test changes were lifted from 5c33815

Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
2024-06-14 11:03:58 +02:00
Tama McGlinn
81b372fecd
fix(lsp): check for nil response from server (#29196)
this only changes the error message, so that it is clear that
the error is with the LSP server, rather than being a crash inside
nvim runtime scripts. We are already doing a lot of validation,
it's just that nil was being overlooked here.

This fixes issue #27395
2024-06-14 11:02:36 +02:00
Yinzuo Jiang
29e05cfb7e
vim-patch:partial:9.1.0482: termdebug plugin needs more love (#29329)
Problem:  termdebug plugin needs more love
Solution: start with some more Vim9 refactoring
          to improve maintenance and readability
          (Ubaldo Tiberi)

List of Changes and the Reasoning Behind Them:

1) Introduction of InitScriptVariables() Function:

Reasoning: This function has been introduced to ensure that when you open and
close Termdebug, and then open it again, there are no leftover script variable
values from the previous session. Leftover values could potentially cause
issues. The goal is for each Termdebug session to be independent of previous
sessions. At startup, all script variables are initialized. The only exception
is g:termdebug_loaded located at the very beginning of the script to prevent
sourcing the script twice. The variables are declared at script level and
defined in InitScriptVariables().

2) More Descriptive Variable Names:

Reasoning: The names of variables have been made more comprehensive. Almost
every Termdebug buffer now has a variable to indicate its name and another
variable to indicate its number, improving code readability and
maintainability. Due to the latest discussion around the &mousemodel option
save/restore mechanism, perhaps some other variables shall be prepended with
saved_.

3) Consistent Naming for GDB Terminal Buffers:

Reasoning: The name of the GDB terminal buffer now matches the name of the GDB
program being used, e.g., 'gdb', 'mygdb', 'arm-eabi-none-gdb', etc. This
ensures clarity and consistency in identifying buffers.

4) Other minor improvements:
Moved EchoErr() on top, added another test, some refactoring, mainly changed
several 0 and 1 to true and false

closes: vim/vim#14980

ef8eab86e2

Co-authored-by: Ubaldo Tiberi <ubaldo.tiberi@volvo.com>
2024-06-14 16:37:38 +08:00
zeertzjq
874869321a
vim-patch:4407461: runtime(netrw): correctly test for windows in NetrwGlob() (#29330)
use has("win32") instead of has("win64") otherwise it
won't work on x86 systems.

440746158c

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-06-14 16:28:55 +08:00
zeertzjq
5def8714ad
fix(terminal): set local values of window options (#29326) 2024-06-14 06:20:42 +08:00
zeertzjq
4a24940980
vim-patch:1487947: runtime(netrw): glob() on windows fails with [] in directory name (#29324)
fixes: vim/vim#14952
closes: vim/vim#14991

1487947fb6

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-06-14 05:48:37 +08:00
zeertzjq
6b022f9d8b
vim-patch:9.1.0483: glob() not sufficiently tested (#29323)
Problem:  glob() not sufficiently tested
Solution: Add more tests for directory containing [] chars

related: vim/vim#14991

8b34aea1b0

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-06-14 05:48:23 +08:00
Lewis Russell
43d8435cf8
revert: "refactor: use S_LEN macro" (#29319)
revert: "refactor: use S_LEN(s) instead of s, n (#29219)"

This reverts commit c37695a5d5.
2024-06-14 05:20:06 +08:00
zeertzjq
6589d05894
Merge pull request #29322 from zeertzjq/vim-02f3ebacfbfa
vim-patch:02f3eba,d353d27
2024-06-14 05:10:38 +08:00
zeertzjq
6ba1521687 vim-patch:d353d27: runtime(doc): restore description of "$" in col() and virtcol() (vim/vim#14981)
These are different from line() and getpos().

d353d27820
2024-06-14 04:49:21 +08:00
zeertzjq
fab3d4721f vim-patch:02f3eba: runtime(doc): deduplicate getpos(), line(), col(), virtcol()
Move the main description to getpos() and link to that from the other
functions.

closes: vim/vim#14970

02f3ebacfb
2024-06-14 04:49:18 +08:00
Christian Clason
f75053a00a vim-patch:902b766: runtime(java): Include element values in non-marker annotations (vim/vim#14979)
Make a formal definition for normal and single-element kinds
of annotations that otherwise require for their containment
to repeat each time all syntax groups that describe element
values.

Reference:
https://docs.oracle.com/javase/specs/jls/se21/html/jls-9.html#jls-9.7

902b766858

Co-authored-by: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
2024-06-13 22:26:54 +02:00
Gregory Anders
0231265c8c
fix(tui): skip TUI in ui_rgb_attached (#29096)
The ui_rgb_attached function determines if any UI is attached which
supports RGB (truecolor). We determine if the TUI supports RGB via the
'termguicolors' option which is checked at the beginning of this
function. If the TUI does not support RGB ('termguicolors' is unset), we
check to see if any _other_ UI is attached which supports RGB.

Normally, the TUI's "rgb" flag and the 'termguicolors' option are the
same. However, they may differ during startup when the "rgb" flag is set
by tui/tui.c to indicate to the core that the terminal emulator supports
truecolor. The 'termguicolors' option is not actually set until
_defaults.lua runs.
2024-06-12 19:55:28 -05:00
Gregory Anders
6311a7fe4b
Merge pull request #29103 from gpanders/test-no-tgc
test: do not set termguicolors in test runner
2024-06-12 19:31:15 -05:00
Lewis Russell
53afdf360c
Merge pull request #29303 from lewis6991/fix/wobuf
fix(vim.wo): never allow non-zero bufnr
2024-06-12 17:30:11 +01:00
Gregory Anders
9cac40ba1e
Merge pull request #29290 from gpanders/push-wuqlkrkuypzz
Add StatusLineTerm highlight group and move terminal buffer defaults
2024-06-12 11:17:53 -05:00
Gregory Anders
d38912b59f refactor(terminal): move :terminal defaults to _defaults.lua 2024-06-12 10:43:57 -05:00
Gregory Anders
3e09fbdf82 feat(highlight): add StatusLineTerm and StatusLineTermNC groups
These highlight groups are used for the statusline in :terminal windows.
By default they link to StatusLine and StatusLineNC (respectively), so
there is no visual difference unless a colorscheme defines these groups
separately.
2024-06-12 10:43:57 -05:00
Lewis Russell
2ca678f57d test: fix vim.deprecate tests 2024-06-12 16:41:26 +01:00
Lewis Russell
8bf79bd13c fix(vim.wo): never allow non-zero bufnr 2024-06-12 15:42:56 +01:00
zeertzjq
7215512100
vim-patch:210b39c: runtime(doc): clarify documentation for "v" position at line() (#29296)
Problem: the previous documentation falsely states that "v" always
refers to the start of a visual area.  In fact, the reference of "v" and
"." complement each other.  If the cursor is at the start of
a (characterwise) visual area, then "v" refers to the end of the area.

Solution: be more verbose and explicit about the connection between "."
and "v" and also refer to |v_o| which many vim users will be familiar
with for visual areas.

210b39c2d6

Co-authored-by: Peter Aronoff <peter@aronoff.org>
2024-06-12 11:44:38 +08:00
zeertzjq
033810ba23
vim-patch:9.1.0477: block_editing errors out when using <enter> (#29294)
Problem:  block_editing errors out when using <enter>
          (Ali Rizvi-Santiago, after v9.1.0274)
Solution: Change ins_len from size_t to int so that the test
          if ins_len is negative actually works properly

Add a test, so that this doesn't regress.

fixes: vim/vim#14960

1fb9eae579

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-06-12 11:07:36 +08:00
zeertzjq
d73910d7f6
vim-patch:b4e648a: runtime(doc): fix typos in syntax.txt (#29293)
b4e648a006

Co-authored-by: Ken Takata <kentkt@csc.jp>
2024-06-12 11:07:22 +08:00
zeertzjq
af8001d100
Merge pull request #29292 from zeertzjq/vim-059cbe893355
vim-patch:059cbe8,959c3c8
2024-06-12 11:06:57 +08:00
zeertzjq
bbe69b4022 vim-patch:959c3c8: runtime(vim): Update base-syntax, configurable comment string highlighting (vim/vim#14931)
Allow highlighting of strings within comments to be disabled by setting
g:vimsyn_comment_strings to false.

959c3c887b

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-06-12 10:29:19 +08:00
zeertzjq
c7799b1a23 vim-patch:059cbe8: runtime(vim): Update base-syntax, match multiline continued comments (vim/vim#13936)
Match multiline (continued) line comments.

Continued tail comments are not supported yet.

059cbe8933

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-06-12 10:22:50 +08:00
Christian Clason
66a1e028e6 vim-patch:2e3b2a8: runtime(kdl): use shiftwidth() instead of &tabstop in indent script
closes: vim/vim#14962

2e3b2a8d89

Co-authored-by: Yinzuo Jiang <jiangyinzuo@foxmail.com>
2024-06-12 00:02:39 +02:00
Gregory Anders
3ad977f01d
feat(terminal): add support for copying with OSC 52 in embedded terminal (#29117)
When libvterm receives the OSC 52 escape sequence it ignores it because
Nvim does not set any selection callbacks. Install selection callbacks
that forward to the clipboard provider, so that setting the clipboard
with OSC 52 in the embedded terminal writes to the system clipboard
using the configured clipboard provider.
2024-06-11 13:18:06 -05:00
bfredl
39d8651283
Merge pull request #29278 from bfredl/strcat
refactor(memory): use builtin strcat() instead of STRCAT()
2024-06-11 19:21:50 +02:00
James
c37695a5d5
refactor: use S_LEN(s) instead of s, n (#29219) 2024-06-11 16:40:24 +01:00
notomo
44410d063a fix(types): add some vim.fn type annotations
Problem: Some vim.fn have no type annotations.

Solution: Add type annotations.
2024-06-11 16:37:15 +01:00
Will Hopkins
e947f226be fix(types): use vararg return type annotation
build(types): allow vararg returns in function types
2024-06-11 16:36:29 +01:00
bfredl
bbd2f340a2 refactor(memory): use builtin strcat() instead of STRCAT()
The latter was mostly relevant with the past char_u madness.

NOTE: STRCAT also functioned as a counterfeit "NOLINT" for clint
apparently. But NOLINT-ing every usecase is just the same as disabling
the check entirely.
2024-06-11 14:53:52 +02:00
Christian Clason
c06f3dbe3e vim-patch:2d88210: runtime(kdl): include syntax, indent and ftplugin files
closes: vim/vim#14956

2d88210b3c

Co-authored-by: inzuo Jiang <jiangyinzuo@foxmail.com>
Co-authored-by: Aram Drevekenin <aram@poor.dev>
2024-06-11 14:00:11 +02:00
Christian Clason
04d3ad1ded vim-patch:b8076f9: runtime(deb822sources): add missing Enabled field in syntax script
closes: vim/vim#14898

It lacks the support of Enabled: boolean option field [1]:

e.g.

  Types: deb
  Uris: https://paulcarroty.gitlab.io/vscodium-deb-rpm-repo/debs/
  Components: main
  Suites: vscodium
  Architectures: amd64 i386 arm64 armhf
  Enabled: yes
  Signed-By: /var/lib/extrepo/keys/vscodium.asc

This patch was also forwarded to upstream. [2]

[1] https://manpages.debian.org/unstable/apt/sources.list.5.en.html#DEB822-STYLE_FORMAT
[2] https://salsa.debian.org/vim-team/vim-debian/-/merge_requests/16

b8076f92a1

Co-authored-by: Kentaro Hayashi <kenhys@gmail.com>
2024-06-11 14:00:11 +02:00
Christian Clason
34b7e00eed vim-patch:7e9a1a7: runtime(svelte): basic svelte ftplugin file
closes: vim/vim#14949

7e9a1a75b8

Co-authored-by: Igor <igorlfs@ufmg.br>
2024-06-11 14:00:11 +02:00
Lewis Russell
5e49ef0af3 refactor(lua): improve type annotations 2024-06-11 12:45:43 +01:00
bfredl
19052e0a06 refactor(shada): use msgpack_sbuffer less
Work towards getting rid of libmsgpack depedency eventually.

msgpack_sbuffer is just a string buffer, we can use our own
String type.
2024-06-11 11:11:38 +02:00
bfredl
d8e384b7bf
Merge pull request #29272 from luukvbaal/signcol
fix(column): clamp line number for legacy signs
2024-06-11 09:52:10 +02:00
Luuk van Baal
1dcda86559 fix(column): clamp line number for legacy signs
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.
2024-06-10 20:00:59 +02:00
Ilia Choly
37bf4c572a
fix(lsp): do not reset buf version when detaching client (#29242) 2024-06-10 18:53:08 +02:00
Justin M. Keyes
d9af8c2431
Merge #29238 from clason/feat/help-toc 2024-06-10 05:22:27 -07:00
Jon Huhn
4bd86120d4
fix(glob): handle overlapping {} condition elements #29236
This change fixes an issue where glob patterns like `{a,ab}` would not
match `ab` because the first option `a` matches, then the end of the
string is expected but `b` is found, and LPeg does not backtrack to try
the next option `ab` which would match. The fix here is to also append
the rest of the pattern to the generated LPeg pattern for each option.
This changes a glob `{a,ab}` from being parsed as

    ("a" or "ab") "end of string"

to

    ("a" "end of string" or "ab" "end of string")

Here, matching against `ab` would try the first option, fail to match,
then proceed to the next option, and match.

The sacrifice this change makes is dropping support for nested `{}`
conditions, which VSCode doesn't seem to support or test AFAICT.

Fixes #28931

Co-authored-by: Sergey Slipchenko <faergeek@gmail.com>
2024-06-10 04:23:03 -07:00
dundargoc
743c5808b6 fix(api): allow scope = 'local' with buf when using nvim_get_option_value
`nvim_get_option_value` throws a warning if both `scope` and `buf`
options are used at the same time. This is because using `buf` always
implies `scope` is local, and is therefore not needed. There's however
no need to error if `scope` is already set "local" as it's the correct
value.
2024-06-10 11:50:39 +02:00
Tom Praschan
20f22f75ee
feat(lsp): include end_col, end_lnum in vim.lsp.buf.locations_to_items #29164 2024-06-09 18:14:55 -07:00