Commit Graph

7510 Commits

Author SHA1 Message Date
zeertzjq
948f2beed4
fix(lua): find length of completion prefix earlier (#29384)
Do the expansion right after setting the expand context, so that the
length of the completion prefix can be set, but don't do that directly
in set_one_cmd_context(), as that's also called by getcmdcompltype().
2024-06-18 09:47:10 +08:00
zeertzjq
c2491fbab4 vim-patch:9.1.0496: matched text is highlighted case-sensitively
Problem:  matched text is highlighted case-sensitively
Solution: use MB_STRNICMP, update highlighting when the base changes
          (glepnir)

fixes: vim/vim#15021
closes: vim/vim#15023

f189138b39

Co-authored-by: glepnir <glephunter@gmail.com>
2024-06-18 06:18:58 +08:00
zeertzjq
c429c5f86f vim-patch:9.1.0495: Matched text isn't highlighted in cmdline pum
Problem:  Matched text isn't highlighted in cmdline pum.
Solution: Use cmdline completion pattern in cmdline mode.
          (zeertzjq)

closes: vim/vim#15029

d8c9340fc6

Cherry-pick syntax.txt change from runtime update.
2024-06-18 06:18:34 +08:00
zeertzjq
20a7eebec0
vim-patch:9.1.0494: Wrong matched text highlighted in pum with 'rightleft' (#29371)
Problem:  Wrong matched text highlighted in pum with 'rightleft'.
Solution: Match using the original text instead of the reversed text.
          (zeertzjq)

closes: vim/vim#15020

63901e8963
2024-06-17 06:42:11 +08:00
zeertzjq
7746c54e10
Merge pull request #29357 from luukvbaal/statuscol
feat(column)!: rework 'statuscolumn' %r/l items
2024-06-17 06:33:15 +08:00
Luuk van Baal
ad70c9892d feat(column)!: rework 'statuscolumn' %r/l items
Problem:  A custom 'statuscolumn' needs to check a bunch of options and
          placed signs to replicate the default number column.
Solution: Rework %l item to include the necessary logic to mimic the
          default number column. Remove now redundant %r item.
2024-06-16 19:04:34 +02:00
Christian Clason
191a70f9dd vim-patch:9.1.0492: filetype: Vim-script files not detected by shebang line
Problem:  Vim-script files may not be recognised
Solution: Add shebang line detection (Doug Kearns)

closes: vim/vim#15012

0d4d23dac0

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-06-16 11:45:44 +02:00
zeertzjq
57c377dfb2
vim-patch:9.1.0493: Test for patch 9.1.0489 doesn't fail without the fix (#29366)
Problem:  Test for patch 9.1.0489 doesn't fail without the fix.
Solution: Use "!" flag of feedkeys() so that ex_normal_busy is not set
          and ins_compl_check_keys() is not skipped (zeertzjq).

closes: vim/vim#15018

acc8746941
2024-06-16 17:30:15 +08:00
zeertzjq
aa319da402
vim-patch:9.1.0489: default completion may break with fuzzy (#29364)
Problem:  default completion may break with fuzzy
Solution: check that completion_match_array is not null
          (glepnir)

closes: vim/vim#15010

aced8c2f4f

Co-authored-by: glepnir <glephunter@gmail.com>
2024-06-16 07:07:06 +08:00
zeertzjq
203540926d
vim-patch:9.1.0491: Cmdline pum doesn't work properly with 'rightleft' (#29355)
Problem:  Cmdline pum doesn't work properly with 'rightleft'.
Solution: Don't use curwin->w_p_rl in cmdline mode in pum_redraw().  Use
          a static variable since pum_may_redraw() may be called in any
          mode.  Also correct position of other popups with 'rightleft'.
          (zeertzjq)

closes: vim/vim#15005

883018feff
2024-06-15 22:37:48 +08:00
zeertzjq
fd2ef4edf9
vim-patch:9.1.0488: Wrong padding for pum "kind" with 'rightleft' (#29352)
Problem:  Wrong padding for pum "kind" with 'rightleft'.
Solution: Fix off-by-one error (zeertzjq).

The screen_fill() above is end-exclusive, and
- With 'rightleft' it fills `pum_col - pum_base_width - n + 1` to `col`,
  so the next `col` should be `pum_col - pum_base_width - n`.
- With 'norightleft' it fills `col` to `pum_col - pum_base_width + n - 1`,
  so the next `col` should be `pum_col - pum_base_width + n`.

closes: vim/vim#15004

a2324373eb
2024-06-15 21:39:56 +08:00
Christian Clason
4faad4a950 vim-patch:9.1.0486: filetype: Snakemake files are not recognized
Problem:  filetype: Snakemake files are not recognized
Solution: Detect '*.smk' and Snakefile files as snakemake filetype
          (Riley Bruins)

See:
https://snakemake.readthedocs.io/en/stable/snakefiles/deployment.html#distribution-and-reproducibility

closes: vim/vim#14992

82a579e15a

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-06-15 10:27:59 +02:00
Jerry
61aabe0730
fix(defaults): default @/Q broken when 'ignorecase' is set (#29343)
Problem:
When 'ignorecase' is set, the default keymap Q and Q would exit visual
mode.

This issue was raised in #28287 and a fix was applied in #28289.

However, `==` operator is subject to user `ignorecase` setting.

Solution:
Switching to `==#` operator would guarantee case sensitive comparison
between visual mode and linewise visual mode.

Co-authored-by: Kuanju Chen <kuanju.chen@mksinst.com>
2024-06-15 10:21:16 +08:00
zeertzjq
199d852d9f
vim-patch:9.1.0487: completed item not update on fuzzy completion (#29341)
Problem:  completed item not update on fuzzy completion
Solution: reset compl_shown_match when at original match position
          (glepnir)

closes: vim/vim#14955

f94c9c482a

Co-authored-by: glepnir <glephunter@gmail.com>
2024-06-15 07:20:38 +08:00
zeertzjq
aacd6c440d vim-patch:9.1.0485: Matched text shouldn't be highlighted in "kind" and "menu"
Problem:  Matched text shouldn't be highlighted in "kind" and "menu".
Solution: Pass hlf_T instead of the attribute.  Fix indent.
          (zeertzjq)

closes: vim/vim#14996

afbe5359e9
2024-06-15 04:58:11 +08:00
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
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
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
5def8714ad
fix(terminal): set local values of window options (#29326) 2024-06-14 06:20:42 +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
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
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
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
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
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
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
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
bfredl
2b2dd6accf
Merge pull request #29141 from bfredl/rstream2
refactor(io): make rstream use a linear buffer
2024-06-09 11:33:00 +02:00
dundargoc
9afa1fd355 feat(lua): add vim._with
It's a function to perform operations in their own sealed context,
similar to pythons `with`. This helps ease operations where you need to
perform an operation in a specific context, and then restore the
context.

Marked as private for now as it's not ready for public use. The current
plan is to start using this internally so we can discover and fix any
problems. Once this is ready to be exposed it will be renamed to
`vim.with`.

Usage:

```lua
local ret = vim._with({context = val}, function()
  return "hello"
end)
```

, where `context` is any combination of:

- `buf`
- `emsg_silent`
- `hide`
- `horizontal`
- `keepalt`
- `keepjumps`
- `keepmarks`
- `keeppatterns`
- `lockmarks`
- `noautocmd`
- `options`
- `sandbox`
- `silent`
- `unsilent`
- `win`

(except for `win` and `buf` which can't be used at the same time). This
list will most likely be expanded in the future.

Work on https://github.com/neovim/neovim/issues/19832.

Co-authored-by: Lewis Russell <lewis6991@gmail.com>
2024-06-08 21:38:06 +02:00
bfredl
78d21593a3 refactor(io): make rstream use a linear buffer
If you like it you shouldn't put a ring on it.

This is what _every_ consumer of RStream used anyway, either by calling
rbuffer_reset, or rbuffer_consumed_compact (same as rbuffer_reset
without needing a scratch buffer), or by consuming everything in
each stream_read_cb call directly.
2024-06-08 12:50:17 +02:00
Lennard Hofmann
da6f68ee69
fix(man): filter OSC 8 hyperlink markup #29171
Problem: `man cmake` shows "8;;https://cmake.orghttps://cmake.org8;;"
Solution: Remove noise so that it shows as "https://cmake.org".
See also: https://en.wikipedia.org/wiki/ANSI_escape_code#OSC
2024-06-07 12:43:17 -07:00
altermo
f3632e14e3
feat: get/set namespace properties #28728
ref https://github.com/neovim/neovim/pull/28432
ref https://github.com/neovim/neovim/issues/28469
2024-06-07 08:33:40 -07:00
Al Colmenar
2ce4a4d91e
fix(lsp): fix reverse sorting of same position text edits (#29212)
Problem:
Text edits with the same position (both line and character) were being
reverse sorted prior to being applied which differs from the lsp spec

Solution:
Change the sort order for just the same position edits
2024-06-07 11:54:43 +02:00
Mathias Fußenegger
6e45cd7f00
fix(lsp): revert buf_versions deprecation/replacement (#29217)
* Revert "fix(lsp): account for changedtick version gap on modified reset (#29170)"

This reverts commit 2e6d295f79.

* Revert "refactor(lsp): replace util.buf_versions with changedtick (#28943)"

This reverts commit 5c33815448.
2024-06-07 11:36:46 +02:00
sus-domesticus
cb6c0fda71
feat(editorconfig): add support for spelling_language (#28638) 2024-06-06 09:16:43 -05:00
zeertzjq
1d4e894403 vim-patch:9.1.0469: Cannot have buffer-local value for 'completeopt'
Problem:  Cannot have buffer-local value for 'completeopt'
          (Nick Jensen).
Solution: Make 'completeopt' global-local (zeertzjq).

Also for some reason test Test_ColonEight_MultiByte seems to be failing
sporadically now. Let's mark it as flaky.

fixes: vim/vim#5487
closes: vim/vim#14922

529b9ad62a
2024-06-06 06:07:31 +08:00
zeertzjq
c235a063d6 vim-patch:9.1.0467: typos in some comments
Problem:  typos in some comments
          (after v9.1.0466)
Solution: fix comments
          (zeertzjq)

closes: vim/vim#14919

551d8c372e
2024-06-06 05:50:12 +08:00
Gregory Anders
d7651b27d5
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.
2024-06-05 08:27:56 -05:00
zeertzjq
43bd9c9c1c
fix(lua): don't clamp -1 or v:maxcol in vim.highlight.range() (#29203) 2024-06-05 16:47:43 +08:00
zeertzjq
164338330b vim-patch:9.1.0463: no fuzzy-matching support for insert-completion
Problem:  no fuzzy-matching support for insert-completion
Solution: enable insert-mode completion with fuzzy-matching
          using :set completopt+=fuzzy (glepnir).

closes: vim/vim#14878

a218cc6cda

Co-authored-by: glepnir <glephunter@gmail.com>
2024-06-05 15:08:31 +08:00
Andre Toerien
f69937fdbd
fix(diagnostic): fix float scope filtering (#29134) 2024-06-04 16:35:44 -05:00
Mathias Fußenegger
2e6d295f79
fix(lsp): account for changedtick version gap on modified reset (#29170)
Follow up to https://github.com/neovim/neovim/pull/28943
Fixes https://github.com/neovim/neovim/issues/29163
2024-06-04 17:21:37 +02:00
luukvbaal
b66106a46c
fix(ui): superfluous showmode / excessive grid_cursor_goto #29089
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.
2024-06-04 06:09:12 -07:00