Commit Graph

31643 Commits

Author SHA1 Message Date
bfredl
20e16c1c49
Merge pull request #32099 from bfredl/no_bufhl
feat(api): deprecate nvim_buf_add_highlight()
2025-01-20 15:42:56 +01:00
Donatas
5b1136a99c
feat(inccommand): preview 'nomodifiable' buffers #32034
Problem:
Incremental preview is not allowed on 'nomodifiable' buffers.

Solution:
- Allow preview on 'nomodifiable' buffers.
- Restore the 'modifiable' option in case the preview function changes it.
2025-01-20 06:40:26 -08:00
Luuk van Baal
92556be33d fix(messages): compute msg_col after last newline in ext_messages
Problem:  We want to keep track of the current message column, which is
          done very rudimentary for ext_messages; only checking if the
          message ends in a newline to reset the column, while computing
          the entire cellwidth of the message, which may contain
          (multiple) newlines not necessarily at the end (since 21718c6).
          This introduced a noticeable delay for large messages (e.g. :=vim).
Solution: Calculate the cellwidth of the message after the last newline.
          Use it to keep track of the current message column. This might
          not be a functional change currently, since it only affects
          messages with (multiple) newlines not at the end of a message,
          which I don't think we emit internally, and msg_col is reset for
          a new kind. It does fix the performance problem.
2025-01-20 15:11:33 +01:00
Konrad Malik
ded15ca8c2
fix: completion.enable(false,...) deletes invalid augroup #32121
Problem:

    vim.lsp.completion.enable(true, client.id, bufnr)
    vim.lsp.completion.enable(false, client.id, bufnr)

    Error detected while processing LspDetach Autocommands for "*":
    Error executing lua callback: …/lsp/completion.lua:701: Vim:E367: No such group: "vim/lsp/completion-22"
    stack traceback:
            [C]: in function 'nvim_del_augroup_by_name'
            …/lsp/completion.lua:701: in function 'disable_completions'
            …/lsp/completion.lua:724: in function 'enable'

Solution:
Delete the correct augroup.
2025-01-20 06:10:00 -08:00
Guilherme Soares
8a236c242a
fix(lsp): set floating window filetype after setup #32112
Problem:
The filetype for the floating window buffer is being set before its context is fully initialized.
This results in `FileType` events not receiving the correct context.

Solution:
Set the filetype after the floating preview window and its buffer variables are
fully configured to ensure proper context is provided.
2025-01-20 05:00:13 -08:00
bfredl
19b25f3fea feat(api): deprecate nvim_buf_add_highlight()
This was kept for a while as it was a useful short hand and initially
matched what highlights what actually properly implemented. But now
|vim.hl.range()| is a better high-level shorthand with full support for
native multi-line ranges.
2025-01-20 13:59:29 +01:00
Jaehwang Jung
27c8806953
docs(treesitter): expose LanguageTree:parent() #32108
Plugins may want to climb up the LanguageTree.

Also add missing type annotations for other methods.
2025-01-20 04:17:36 -08:00
bfredl
71922cd1dc
Merge pull request #31597 from bfredl/deletionism
fix(wininfo): when freeing windows, free the lowest priority wininfo
2025-01-20 11:02:58 +01:00
Christian Clason
5b025b499e vim-patch:9.1.1030: filetype: setting bash filetype is backwards incompatible
Problem:  filetype: setting bash filetype is backwards incompatible
Solution: revert patch v9.1.0965, detect bash scripts again as sh
          filetype

This reverts commit b9b762c21f2b61e0e7d8fee43d4d3dc8ecffd721.

related: vim/vim#16309

727c567a09

Co-authored-by: Christian Brabandt <cb@256bit.org>

vim-patch:9.1.1033: tests: shaderslang was removed from test_filetype erroneously

Problem:  tests: shaderslang was removed from test_filetype erroneously
          (Christian Clason, after v9.1.1030)
Solution: restore the test

1d2867df0c

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-01-20 08:20:36 +01:00
Christian Clason
b172dd57fa vim-patch:2cb8246: runtime(tex): add texEmphStyle to texMatchGroup in syntax script
fixes: vim/vim#16228

2cb8246eb9

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Github User JordL
2025-01-20 08:20:24 +01:00
Christian Clason
4dc2e016da vim-patch:d402ba8: runtime(netrw): upstream snapshot of v175
Relevant commits:
- release: netrw v175
- fix: prevent netrw to load into the built-in terminal
- fix: restore correctly cpo settings
- fix(docs): mispelled original authors name
- chore: move viml files to new formatting standard

fixes: vim/vim#16463
closes: vim/vim#16465

d402ba81e2

Co-authored-by: Luca Saccarola <github.e41mv@aleeas.com>
2025-01-20 08:20:11 +01:00
Christian Clason
de83cc5842 fix(netrw): re-add missing comment marker in syntax file 2025-01-20 08:20:11 +01:00
Mathias Fussenegger
5f527f24f0 fix(lsp): don't use completion filterText if prefix is empty
Follow up to https://github.com/neovim/neovim/pull/32072

If there is no prefix (e.g. at the start of word boundary or a line), it
always used the `filterText` because the `match` function always
returned false.
2025-01-19 22:11:20 +01:00
Yochem van Rosmalen
d56ba71af1
fix(lsp): document_symbol uses loclist by default #32070
Problem: Not able to open document symbols for different buffers

Solution: Use the location list as default.

To switch back to previous behavior (qflist):

  vim.lsp.buf.document_symbol({ loclist = false })

Fixes: #31832
2025-01-19 13:08:10 -08:00
deepsghimire
a6f219b06b
fix(log): unintuitive message for undefined $TMPDIR 2025-01-19 11:37:04 -08:00
Jaehwang Jung
6696ea7f10 fix(treesitter): clean up parsing queue 2025-01-19 15:53:17 +01:00
zeertzjq
ee54069d1d
vim-patch:8dec6c2: runtime(vim): Update base-syntax, fix is/isnot operator matching (#32100)
- Match is? and isnot? operators.
- Limit other comparison operators to one match modifier rather than
  two.

closes: vim/vim#16482

8dec6c2e6c

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-01-19 22:14:52 +08:00
Devon Gardner
71507281fb
fix(coverity/530826): validate_opt_idx unchecked negative idx (#32081)
Problem:
opt_idx possible negative value used as index

Solution:
check opt_idx not less than zero (kOptInvalid)
2025-01-19 08:49:53 +08:00
林玮 (Jade Lin)
a5b1b83a26 fix(lua): prevent SIGSEGV when lua error is NULL in libuv_worker
Problem:
Calling `xstrdup` with a NULL pointer causes a SIGSEGV if `lua_tostring` returns
NULL in `nlua_luv_thread_common_cfpcall`.

Crash stack trace:
- `_platform_strlen` → `xstrdup` (memory.c:469)
- `nlua_luv_thread_common_cfpcall` (executor.c:281)

Solution:
Check if `lua_tostring` returns NULL and pass NULL to `event_create` to avoid the crash.
2025-01-18 19:08:50 +00:00
Gregory Anders
51ccd12b3d
fix(diagnostic)!: make virtual text handler opt-in (#32079)
Making this opt-out (on by default) was the wrong choice from the
beginning. It is too visually noisy to be enabled by default.

BREAKING CHANGE: Users must opt-in to the diagnostic virtual text
handler by adding

  vim.diagnostic.config({ virtual_text = true })

to their config.
2025-01-18 07:43:21 -06:00
Christian Clason
954d4969c9 vim-patch:e064051: runtime(c): add new constexpr keyword to syntax file (C23)
closes: vim/vim#16471

e06405181a

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-01-18 11:54:53 +01:00
Christian Clason
7d04ebd43c vim-patch:54cb514: runtime(sh): update syntax script
- remove duplicated keywords
- add bash coproc and COPROC_PID keywords

54cb514c9a

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-01-18 11:48:35 +01:00
dundargoc
27da6f7757 refactor: simplify bump_deps.lua
Simplify usage and remove redundant flags and code.
2025-01-18 10:52:51 +01:00
Christian Clason
e962167245 vim-patch:9cfdabb: runtime(netrw): change netrw maintainer
Dr. Chip retired some time ago and is no longer maintaining the netrw
plugin. However as a runtime plugin distributed by Vim, it important to
maintain the netrw plugin in the future and fix bugs as they are
reported.

So, split out the netrw plugin as an additional package, however include
some stubs to make sure the plugin is still loaded by default and the
documentation is accessible as well.

closes: vim/vim#16368

9cfdabb074

Co-authored-by: Luca Saccarola <github.e41mv@aleeas.com>
2025-01-18 09:49:35 +01:00
Christian Clason
136cb642a0 vim-patch:c2a967a: runtime(c): Update syntax and ftplugin files
- highlight more C keywords, including some from C23

Conditionally highlight C23 features:
- #embed, #elifdef and #elifndef preprocessor directives
- predefined macros
- UTF-8 character constants
- binary integer constants, _BitInt literals, and digit separators
- nullptr_t type and associated constant
- decimal real floating-point, bit precise and char types
- typeof operators

Matchit:
- update for new preprocessor directives

fixes: vim/vim#13667
fixes: vim/vim#13679
closes: vim/vim#12984

c2a967a1b9

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Co-authored-by: Albin Ahlbäck <albin.ahlback@gmail.com>
2025-01-18 08:45:43 +01:00
zeertzjq
c9000a6b13
vim-patch:9.1.1028: too many strlen() calls in screen.c (#32083)
Problem:  too many strlen() calls in screen.c
Solution: refactor screen.c and remove calls to strlen(),
          verify that leadmultispace != NULL (John Marriott)

closes: vim/vim#16460

c15de972e8

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-01-18 02:03:13 +00:00
Yochem van Rosmalen
c6cc937512
docs: change augroup names to new convention #32061
Ref: 09e01437c9
2025-01-17 14:56:30 -08:00
Mathias Fussenegger
b9e6fa7ec8 fix(lsp): use filterText as word if textEdit/label doesn't match
Problem:

With language servers like lemminx, completing xml tags like `<mo` first
shows the right candidates (`modules`) but after typing `d` the
candidates disappear.

This is because the server returns:

    [...]
    filterText = "<module",
    label = "module",
    textEdit = {
      newText = "<module>$1</module>$0",

Which resulted in `module` being used as `word`, and `module` doesn't
match the prefix `<mo`. Typing `d` causes the `complete()` filtering
mechanism to kick in and remove the entry.

Solution:

Use `<module` from the `filterText` as `word` if the textEdit/label
heuristic doesn't match.
2025-01-17 18:34:58 +01:00
Christian Clason
3530182ba4 vim-patch:9.1.1026: filetype: swc configuration files are not recognized
Problem:  filetype: swc configuration files are not recognized
Solution: detect .swcrc files as json filetype (Marces Engel)

References:
https://swc.rs/docs/configuration/swcrc

closes: vim/vim#16462

3a738fccaa

Co-authored-by: Marces Engel <marces@facemurphy.com>
2025-01-17 16:45:59 +01:00
Christian Clason
97d5855351 docs(gh): use new issue types 2025-01-17 16:41:39 +01:00
Luuk van Baal
5dd60e01ac refactor(cmdline): more idiomatic way to avoid cmdline_show
Problem:  Fix applied in #32033 can be more idiomatic.
Solution: Unset redraw_state instead of cmdbuff.
2025-01-17 08:40:50 +01:00
Luuk van Baal
7ce27381fb fix(messages): lsp window/showMessage is not an error
Ref https://github.com/neovim/neovim/discussions/32015
2025-01-17 08:40:50 +01:00
zeertzjq
ac3859a441
vim-patch:a234a46: runtime(doc): fix typo in usr_02.txt (#32063)
fixes: vim/vim#16455

a234a46651

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-01-17 09:09:47 +08:00
zeertzjq
cd92924896
vim-patch:9.1.1021: string might be used without a trailing NUL (#32062)
Problem:  string might be used without a trailing NUL (after v9.1.0997)
Solution: Make sure that the buffer is NUL terminated

closes: vim/vim#16457

70dfc374ec

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-01-17 08:53:10 +08:00
zeertzjq
0d3a8e8c1a
vim-patch:9.1.1020: no way to get current selected item in a async context (#32056)
Problem:  no way to get current selected item in a async context
Solution: add completed flag to show the entries of currently selected
          index item (glepnir)

closes: vim/vim#16451

037b028a22

Co-authored-by: glepnir <glephunter@gmail.com>
2025-01-17 08:38:58 +08:00
Gregory Anders
bf098c12e3
Merge pull request #32038 from gpanders/push-nsrttwwnsqvm
feat(terminal): add support for kitty keyboard protocol
2025-01-16 18:33:22 -06:00
Gregory Anders
819337a13f test: use esc sequences in vterm unit tests 2025-01-16 16:41:37 -06:00
Gregory Anders
6f0bde11cc feat(terminal): add support for kitty keyboard protocol
This commit adds basic support for the kitty keyboard protocol to
Neovim's builtin terminal. For now only the first mode ("Disambiguate
escape codes") is supported.
2025-01-16 16:41:08 -06:00
Lewis Russell
fb564ddff0
refactor(options): generic expand and did_set callbacks (#32011)
* refactor(options): generic expand and did_set callbacks

Problem:

Many options have similar callbacks to check the values are valid.

Solution:

Generalize these callbacks into a single function that reads the option
table.

* refactor: gen_options.lua

refactor: gen_options.lua - inline get_cond

* refactor(options): use a simpler format for the common default
2025-01-16 20:53:17 +00:00
zeertzjq
92d3bf101d
Merge pull request #32051 from zeertzjq/vim-9.1.1013
vim-patch:9.1.{1013,1017}
2025-01-16 12:20:33 +08:00
zeertzjq
47a4e42392 vim-patch:9.1.1017: Vim9: Patch 9.1.1013 causes a few problems
Problem:  Vim9: Patch 9.1.1013 causes a few problems
Solution: Translate the function name only when it is a string
          (Yegappan Lakshmanan)

fixes: vim/vim#16453
closes: vim/vim#16450

9904cbca41

Cherry-pick call() change from patch 9.0.0345.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-01-16 11:17:14 +08:00
zeertzjq
f8680d0097 vim-patch:9.1.1013: Vim9: Regression caused by patch v9.1.0646
Problem:  Vim9: Regression caused by patch v9.1.0646
Solution: Translate the function name before invoking it in call()
          (Yegappan Lakshmanan)

fixes: vim/vim#16430
closes: vim/vim#16445

6289f91591

N/A patch:
vim-patch:8.2.4176: Vim9: cannot use imported function with call()

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-01-16 11:17:14 +08:00
zeertzjq
718e165360
vim-patch:9.1.1018: v9.1.0743 causes regression with diff mode (#32047)
Problem:  v9.1.0743 causes regression with diff mode
Solution: Fix the regression with overlapping regions

closes: vim/vim#16454

01f6509fb2

Co-authored-by: Yukihiro Nakadaira <yukihiro.nakadaira@gmail.com>
2025-01-16 01:16:25 +00:00
Christian Clason
524be56042
vim-patch:9.1.1019: filetype: fd ignore files are not recognized (#32042)
Problem:  filetype: fd ignore files are not recognized
Solution: detect .fdignore files as gitignore filetype

closes: vim/vim#16444

3058087f6f

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2025-01-16 07:34:25 +08:00
Christian Clason
f0fdc1de6c build(deps): bump libuv to v1.50.0 2025-01-15 19:54:54 +01:00
dundargoc
7c65224257 build: fix lint error on macos 2025-01-15 18:54:08 +01:00
luukvbaal
bbf36ef8ef
fix(cmdline): prevent cmdline_show events after exiting cmdline #32033
Problem:  If a (vim.ui_attach) cmdline_hide callback triggers a redraw,
          it may cause cmdline_show events for an already exited cmdline.
Solution: Avoid emitting cmdline_show event when ccline.cmdbuff is
          already NULL. Unset ccline.cmdbuff before emitting cmdline_hide.
2025-01-15 06:55:21 -08:00
luukvbaal
5cc93ef472
fix(marks): revise metadata for start mark of revalidated pair #32017
Problem:  Metadata may be revised for end mark of a revalidated pair.
Solution: Revise metadata for start mark of a revalidated pair.
2025-01-15 02:38:45 -08:00
Evgeni Chasnovski
09bcb31068
fix(docs): replace yxx mappings with g== #31947
Problem:
`yx` uses "y" prefix, which shadows a builtin operator.

Solution:
Use `g=` (in the form of `g==` currently), drawing from precedent of
CTRL-= and 'tpope/vim-scriptease'.
2025-01-15 02:36:00 -08:00
Justin M. Keyes
9552fe7ef9
Merge #32013 from luukvbaal/shellkind 2025-01-15 02:23:44 -08:00