Commit Graph

31374 Commits

Author SHA1 Message Date
zeertzjq
51c380238c
Merge pull request #31615 from zeertzjq/vim-9.1.0936
vim-patch:9.1.{0936,0941,0942}: ComplMatchIns highlight
2024-12-18 08:40:23 +08:00
zeertzjq
b7da54aa9e vim-patch:9.1.0942: a few typos were found
Problem:  a few typos were found
Solution: fix them (zeertzjq)

closes: vim/vim#16232

d32bf0a067
2024-12-18 08:15:31 +08:00
zeertzjq
2f7b385f2e vim-patch:9.1.0941: ComplMatchIns doesn't work after multibyte chars
Problem:  ComplMatchIns doesn't work after multibyte chars
          (after v9.1.0936)
Solution: Use (ptr - line) instead of wlv.col (zeertzjq).

closes: vim/vim#16233

f4ccada5c3
2024-12-18 08:15:31 +08:00
zeertzjq
c830901e8c vim-patch:9.1.0936: cannot highlight completed text
Problem:  cannot highlight completed text
Solution: (optionally) highlight auto-completed text using the
          ComplMatchIns highlight group (glepnir)

closes: vim/vim#16173

6a38aff218

Co-authored-by: glepnir <glephunter@gmail.com>
2024-12-18 08:15:31 +08:00
Gregory Anders
0dd933265f
feat(terminal)!: cursor shape and blink (#31562)
When a terminal application running inside the terminal emulator sets
the cursor shape or blink status of the cursor, update the cursor in the
parent terminal to match.

This removes the "virtual cursor" that has been in use by the terminal
emulator since the beginning. The original rationale for using the
virtual cursor was to avoid having to support additional UI methods to
change the cursor color for other (non-TUI) UIs, instead relying on the
TermCursor and TermCursorNC highlight groups.

The TermCursor highlight group is now used in the default 'guicursor'
value, which has a new entry for Terminal mode. However, the
TermCursorNC highlight group is no longer supported: since terminal
windows now use the real cursor, when the window is not focused there is
no cursor displayed in the window at all, so there is nothing to
highlight. Users can still use the StatusLineTermNC highlight group to
differentiate non-focused terminal windows.

BREAKING CHANGE: The TermCursorNC highlight group is no longer supported.
2024-12-17 07:11:41 -06:00
Shougo
df367cf91c
test: unreliable test "messages &messagesopt wait" #31548 2024-12-17 04:19:55 -08:00
luukvbaal
6bf2a6fc5b
refactor(api): always use TRY_WRAP #31600
Problem:  Two separate try/end wrappers, that only marginally differ by
          restoring a few variables. Wrappers that don't restore
          previous state are dangerous to use in "api-fast" functions.
Solution: Remove wrappers that don't restore the previous state.
          Always use TRY_WRAP.
2024-12-17 04:12:22 -08:00
zeertzjq
b03e790cdd
vim-patch:9.1.0934: hard to view an existing buffer in the preview window (#31605)
Problem:  hard to view an existing buffer in the preview window
Solution: add the :pbuffer command (Yinzuo Jiang)

Similar as `:pedit` and `:buffer` command. `:pbuffer` edits buffer [N]
from the buffer list in the preview window.

`:pbuffer` can also open special buffer, for example terminal buffer.

closes: vim/vim#16222

a2a2fe841e

Cherry-pick Test_popup_and_previewwindow_dump() changes from patch
9.0.0625.
Cherry-pick Run_noroom_for_newwindow_test() changes from patches
8.2.0432 and 9.0.0363.

Co-authored-by: Yinzuo Jiang <jiangyinzuo@foxmail.com>
2024-12-17 03:34:30 +00:00
zeertzjq
15153c4cd5
vim-patch:9.1.0938: exclusive selection not respected when re-selecting block mode (#31603)
Problem:  exclusive selection not respected when re-selecting block mode
          (Matt Ellis)
Solution: advance selection by another character when using
          selection=exclusive and visual block mode

fixes: vim/vim#16202
closes: vim/vim#16219

bb95589473

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-12-17 09:03:26 +08:00
zeertzjq
137308a3c9
Merge pull request #31602 from zeertzjq/vim-0a4e57f
vim-patch: doc updates
2024-12-17 09:01:59 +08:00
zeertzjq
7d082d4816 vim-patch:3920bb4: runtime(doc): document how to minimize fold computation costs
closes: vim/vim#16224

3920bb4356

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2024-12-17 08:27:44 +08:00
zeertzjq
59f38ef3c4 vim-patch:0a4e57f: runtime(doc): fix a few minor errors from the last doc updates
1) move the section at :h inclusive-motion-selection-exclusive a few
lines below, so that it doesn't live in between the 2 exceptions.

2) remove the tag :h :!-range. It's not accurate (because it is actually
a filter) and this command is already described at :h :range!

0a4e57f44a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-12-17 08:21:31 +08:00
zeertzjq
98e3610316 vim-patch:41d6de2: runtime(doc): update the change.txt help file
41d6de2974

Co-authored-by: Antonio Giovanni Colombo <azc100@gmail.com>
2024-12-17 08:20:18 +08:00
Justin M. Keyes
022449b522
fix(api): generic error messages, not using TRY_WRAP #31596
Problem:
- API functions using `try_start` directly, do not surface the
  underlying error message, and instead show generic messages.
- Error-handling code is duplicated in the API impl.
- Failure modes are not tested.

Solution:
- Use `TRY_WRAP`.
- Add tests.
2024-12-16 08:34:16 -08:00
Christian Clason
fb8372adb3 build(deps): bump luajit to HEAD - f73e649a9 2024-12-16 17:08:52 +01:00
Lewis Russell
47f2769b46 fix(Man): completion on Mac
Problem:
`man -w` does not work on recent versions of MacOs.

Solution:
Make it so an empty result is interpreted as an error unless silent=true
2024-12-16 16:05:08 +00:00
dundargoc
b5c0290803 ci(build.yml): disable security restriction
A new security restriction in Ubuntu 24.04 prevents users from using
`unshare`, so we need to disable it in order for the test to work
properly.
2024-12-16 16:26:19 +01:00
Juan Cruz De La Torre
6c975515c5
fix(diagnostic): vim.diagnostic.setqflist() opens loclist on first call #31585
Problem:
Regression from de794f2d24: `vim.diagnostic.setqflist{open=true}` attempts to
open the location list instead of the diagnostics quickfix list if it didn't
exist before. This is because we are using `qf_id` to decide which to open, but
`qf_id=nil` when there is no existing diagnostics quickfix list with a given
title ("Diagnostics" by default).

Solution:
- Revert to using `loclist` to decide which to open.
- Add tests.
2024-12-16 06:38:57 -08:00
bfredl
798f928479
Merge pull request #31539 from bfredl/wininfo
refactor(wininfo): change wininfo from a linked list to an array
2024-12-16 13:24:09 +01:00
Justin M. Keyes
167a2383b9
fix(api): not using TRY_WRAP, generic error messages #31595
Problem:
- API functions using `try_start` directly instead of `TRY_WRAP`, do not
  surface the underlying error message, and instead show generic things
  like "Failed to set buffer".
- Error handling code is duplicated in the API impl, instead of
  delegating to the vim buffer/window handling logic.

Solution:
- Use `TRY_WRAP`.
2024-12-16 04:00:20 -08:00
bfredl
2d6f57b289 refactor(wininfo): change wininfo from a linked list to an array
"wininfo" is going to be my next victim. The main problem with wininfo
is that it is "all or nothing", i e either all state about a buffer in a
window is considered valid or none of it is. This needs to be fixed to
address some long running grievances.

For now this is just a warmup: refactor it from a linked list to a
vector.
2024-12-16 12:46:59 +01:00
Tomasz N
9c6a3703bb
fix(messages): no message kind for :undo messages #31590
Problem: cannot handle `:undo` and `:redo` messages in a special way,
e.g. replace one by another.

Solution: add `undo` kind.
2024-12-16 03:07:27 -08:00
phanium
01a97d2ad7
fix(api): nvim_win_set_buf(0, 0) fails if 'winfixbuf' is set #31576
## Problem
With 'winfixbuf' enabled, `nvim_win_set_buf` and `nvim_set_current_buf` fail
even if targeting the already-current buffer.

    vim.wo.winfixbuf = true
    vim.api.nvim_win_set_buf(0, 0)
    vim.api.nvim_set_current_buf(0)

Solution:
Check for this condition.
2024-12-16 00:59:24 -08:00
Christian Clason
cc38630d39 vim-patch:9.1.0929: filetype: lalrpop files are not recognized
Problem:  filetype: lalrpop files are not recognized
Solution: detect '*.lalrpop' files as lalrpop filetype
          (David Thievon)

References:
https://github.com/lalrpop/lalrpop

closes: vim/vim#16223

5a2e0cf5f1

Co-authored-by: David Thievon <pdkfan@gmail.com>
2024-12-16 00:19:16 +01:00
Christian Clason
6c2c77b128 vim-patch:9.1.0926: filetype: Pixi lock files are not recognized
Problem:  filetype: Pixi lock files are not recognized
Solution: detect "pixi.lock" file as yaml filetype
          (Brandon Maier)

Reference:
https://pixi.sh/latest/features/lockfile/

closes: vim/vim#16212

7d1bb90dcf

Co-authored-by: Brandon Maier <brandon.maier@gmail.com>
2024-12-15 12:42:27 +01:00
Christian Clason
820984daea build(deps): bump tree-sitter to v0.24.5 2024-12-15 12:35:11 +01:00
zeertzjq
852b6a6bce
vim-patch:9.1.0927: style issues in insexpand.c (#31581)
Problem:  style issues in insexpand.c
Solution: add braces, use ternary operator to improve style
          (glepnir)

closes: vim/vim#16210

6e19993991

vim-patch:9.1.0922: wrong MIN macro in popupmenu.c
vim-patch:9.1.0923: too many strlen() calls in filepath.c
vim-patch:9.1.0924: patch 9.1.0923 causes issues

Co-authored-by: glepnir <glephunter@gmail.com>
2024-12-15 08:19:18 +08:00
zeertzjq
805b84c619
Merge pull request #31580 from zeertzjq/vim-ed89206
vim-patch: doc updates
2024-12-15 08:16:03 +08:00
zeertzjq
3406b00911 vim-patch:fbe9a69: runtime(doc): Add a reference to |++opt| and |+cmd| at :h :pedit
closes: vim/vim#16217

fbe9a6903a

Co-authored-by: Yinzuo Jiang <jiangyinzuo@foxmail.com>
2024-12-15 07:10:12 +08:00
zeertzjq
caa93b5e1e vim-patch:ed89206: runtime(doc): add a note about inclusive motions and exclusive selection
related: vim/vim#16202

ed89206efe

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-12-15 07:09:39 +08:00
luukvbaal
433b342baa
feat(ui): sign/statuscolumn can combine highlight attrs #31575
Problem:
Since e049c6e4c0, most statusline-like UI elements can combine
highlight attrs, except for sign/statuscolumn.

Solution:
Implement for sign/statuscolumn.
2024-12-14 10:21:50 -08:00
Colin Kennedy
f9dd682621 docs(annotations): added ---@generic support 2024-12-13 17:05:38 +00:00
Justin M. Keyes
65b1733405
Revert "fix(Man.lua): trigger completion even without arguments" #31572
This reverts commit 7940ec6913.
2024-12-13 06:46:40 -08:00
Lewis Russell
9c20342297 fix(lsp): reuse client if configs match and no root dir
Problem:
An LSP configuration that creates client with no root_dir or
workspace_folders can result in vim.lsp.enable attaching to it multiple
times.

Solution:
When checking existing clients, reuse a client if it wasn't initially
configured have any workspace_folders. This more closely matches the
behaviour we had prior to d9235ef
2024-12-13 14:36:24 +00:00
Luca Saccarola
7940ec6913
fix(man.lua): :Man <tab> does not complete #31569
closes: #31512
2024-12-13 06:26:20 -08:00
zeertzjq
c0ae39ee53
Merge pull request #31566 from zeertzjq/vim-9.1.0921
vim-patch:9.1.{0921,0922}
2024-12-13 21:58:18 +08:00
zeertzjq
1386d36e76 vim-patch:9.1.092: vim-patch:9.1.0923: wrong MIN macro in popupmenu.c
Problem:  wrong MIN macro in popupmenu.c (after v9.1.0921)
          (zeertzjq)
Solution: change it to MAX()

618c4d36ca

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: glepnir <glephunter@gmail.com>
2024-12-13 21:33:26 +08:00
zeertzjq
8a0b203875 vim-patch:9.1.0921: popupmenu logic is a bit convoluted
Problem:  popupmenu logic is a bit convoluted
Solution: slightly refactor logic and use MIN/MAX() macros to simplify
          (glepnir)

Define the MAX/MIN macros. Since we support some older platforms, C
compilers may not be as smart. This helps reduce unnecessary if
statements and redundant ternary expressions. Pre-calculate some
expressions by defining variables. Remove unnecessary parentheses.
Adjust certain lines to avoid exceeding 80 columns.

closes: vim/vim#16205

c942f84aad

Co-authored-by: glepnir <glephunter@gmail.com>
2024-12-13 20:01:26 +08:00
Christian Clason
3e3a984300 vim-patch:5c42c77: runtime(netrw): do not pollute search history with symlinks
fixes: vim/vim#16206

5c42c77315

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-12-13 09:38:19 +01:00
Christian Clason
2e73ba102a vim-patch:9.1.0919: filetype: some assembler files are not recognized
Problem:  filetype: some assembler are files not recognized
Solution: detect '*.nasm' files as nasm filetype and '*.masm' as masm
          filetype (Wu, Zhenyu)

closes: vim/vim#16194

d66d68763d

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-12-13 09:38:08 +01:00
glepnir
17383870dd
fix(float): re-sort layers when grid zindex changed #30259
Problem: when zindex is changed in vim.schedule the zindex sort in
layers not changed.

Solution: resort layers when zindex changed.
2024-12-12 02:45:57 -08:00
Jeremy Fleischman
de794f2d24
fix(diagnostic): broken variable reference #31557 2024-12-12 02:41:57 -08:00
Lewis Russell
130f4344cf refactor(lsp/rpc): move transport logic to separate module 2024-12-12 09:52:08 +00:00
Jeremy Fleischman
5eda7aafe9
fix(diagnostic): setqflist() is stuck after vim.lsp.buf.document_symbol #31553
Previously, when updating the quickfix diagnostics list, we'd update it,
and then open the quickfix buffer, but there was no guarantee that the
quickfix buffer would be displaying the quickfix diagnostics list (it
could very possibly be displaying some other quickfix list!).

This fixes things so we first select the quickfix list before opening the
quickfix buffer. If `open` is not specified, the behavior is the same as
before: we update the diagnostics quickfix list, but do not navigate to
it.

fixes https://github.com/neovim/neovim/issues/31540
2024-12-11 17:32:07 -08:00
Jeremy Fleischman
21961967ff
feat(diagnostic): update quickfix list by title #31486
Previously, there was a singleton diagnostics quickfix list. Now there's
effectively one per title (up to vim's internal limit on quickfix
lists).

Suggested by mfussenegger https://github.com/neovim/neovim/pull/30868#pullrequestreview-2385761374.
2024-12-11 17:29:54 -08:00
Jonny Kong
442d338cb5
fix(uri): uri_encode encodes brackets incorrectly for RFC2732 #31284
**Problem:**
The brackets in the RFC2732 regular expression are currently unescaped,
causing them to be misinterpreted as special characters denoting
character groups rather than as literal characters.

**Solution:**
Escape the brackets.
Fix #31270
2024-12-11 05:48:17 -08:00
glepnir
ff1791c9e5
fix(float): close preview float window when no selected #29745
Problem: Float preview window still exist when back at original.
Or no info item is selected.

Solution: if selected is -1 or no info is selected, if float preview
window exist close it first.
2024-12-11 05:20:10 -08:00
Riley Bruins
3dfb9e6f60
feat(treesitter): include capture id in return value of get_captures_at_pos() #30559
**Problem:** Currently, it is difficult to get node(s)-level metadata
for a capture returned by `get_captures_at_pos()`. This is because it is
stored in `metadata[id]` and we do not have access to the value of `id`,
so to get this value we have to iterate over the keys of `metadata`. See
[this commit](d636229300 (diff-8bd4742121c2f359d0345f3c6c253a58220f1a28670cc4e1c957992232059a6cR16)).

Things would be much simpler if we were given the `id` of the capture so
we could use it to just index `metadata` directly.

**Solution:** Include `id` in the data returned by
`get_captures_at_pos()`
2024-12-11 04:34:24 -08:00
Colin Kennedy
492ae57aa6
docs(annotation): return types for Vimscript functions #31546 2024-12-11 03:27:08 -08:00
Lewis Russell
3f1d09bc94 feat(lsp): add vim.lsp.config and vim.lsp.enable
Design goals/requirements:
- Default configuration of a server can be distributed across multiple sources.
  - And via RTP discovery.
- Default configuration can be specified for all servers.
- Configuration _can_ be project specific.

Solution:

- Two new API's:
  - `vim.lsp.config(name, cfg)`:
    - Used to define default configurations for servers of name.
    - Can be used like a table or called as a function.
    - Use `vim.lsp.confg('*', cfg)` to specify default config for all
      servers.
  - `vim.lsp.enable(name)`
    - Used to enable servers of name. Uses configuration defined
    via `vim.lsp.config()`.
2024-12-10 17:16:01 +00:00