Commit Graph

31361 Commits

Author SHA1 Message Date
Yi Ming
629483e24e
feat(lsp): require offset_encoding param #31249
Problem:
Since [version 3.17](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocuments),
LSP supports specifying the position encoding (aka offset encoding) supported by
the client through `positionEncoding`. Since #31209, Nvim fully supports
`utf-8`, `utf-16`, and `utf-32` encodings.

Previously, nvim assumed all clients for a buffer had the same
`offset_encoding`, so:
* Nvim provides `vim.lsp._get_offset_encoding()` to get `offset_encoding`, but
  this function is incorrect because `offset_encoding` is per-client, not
  per-buffer.
* Based on the strategy of `vim.lsp._get_offset_encoding()`,
  `vim.lsp.util.make_position_params()`, `vim.lsp.util.make_range_params()`, and
  `vim.lsp.util.make_given_range_params()` do not require the caller to pass
  `offset_encoding`, which is invalid.
* https://github.com/neovim/neovim/issues/25272

Solution:
* Mark `vim.lsp._get_offset_encoding()` as `@deprecated`.
* Change the type annotations of `vim.lsp.util.make_position_params()`,
  `vim.lsp.util.make_range_params()`, `vim.lsp.util.make_given_range_params()`
  to require the `offset_encoding` param.
2024-11-20 12:19:07 -08:00
luukvbaal
1b6442034f
fix(messages): more ext_messages kinds #31279
Add kinds for various commands that output a list, the 'wildmode'
list, and for number prompts.
2024-11-20 12:11:20 -08:00
zeertzjq
0e2f92ed79
build(clint): make NOLINT work with header checks (#31281)
Problem:  NOLINT doesn't work with header checks.
Solution: Move these checks after ProcessLine() calls.
2024-11-20 22:51:58 +08:00
Lewis Russell
454ae672aa feat(lsp): deprecate non-method client functions
Deprecated:
- `client.request()` -> `client:request()`
- `client.request_sync()` -> `client:request_sync()`
- `client.notify()` -> `client:notify()`
- `client.cancel_request()` -> `client:cancel_request()`
- `client.stop()` -> `client:stop()`
- `client.is_stopped()` `client:is_stopped()`
- `client.supports_method()` -> `client:supports_method()`
- `client.on_attach()` -> `client:on_attach()`

Fixed docgen to link class fields to the full function doc.
2024-11-20 08:51:45 +00:00
Christian Clason
f55c842ec7 vim-patch:9.1.0880: filetype: C3 files are not recognized
Problem:  filetype: C3 files are not recognized
Solution: detect '*.c3*' files as c3 filetype (Turiiya)

closes: vim/vim#16087

c8dfcfc53b

Co-authored-by: Turiiya <34311583+ttytm@users.noreply.github.com>
2024-11-20 09:31:15 +01:00
Christian Clason
23ead4f2cb vim-patch:9.1.0876: filetype: openCL files are not recognized
Problem:  filetype: openCL files are not recognized
Solution: detect '*.cl' files as opencl or lisp filetype,
          include a opencl syntax and filetype plugin (Wu, Zhenyu)

closes: vim/vim#15825

e2c27ca8ef

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-11-20 09:31:15 +01:00
Christian Clason
4c85c217d3 vim-patch:9.1.0875: filetype: hyprlang detection can be improved
Problem:  filetype: hyprlang detection can be improved
Solution: detect '/hypr/*.conf' files as hyprlang filetype,
          include basic syntax highlighting (Luca Saccarola)

fixes: vim/vim#15875
closes: vim/vim#16064

a13bd294ab

Co-authored-by: Luca Saccarola <github.e41mv@aleeas.com>
2024-11-20 09:31:15 +01:00
Christian Clason
de9ed1ca54 vim-patch:9.1.0874: filetype: karel files are not detected
Problem:  filetype: karel files are not detected
Solution: detect '*.kl' files as karel filetype,
          include syntax and filetype plugin
          (Kirill Morozov)

closes: vim/vim#16075

fdac54d7bb

Co-authored-by: Kirill Morozov <kirill@robotix.pro>
Co-authored-by: KnoP-01 <knosowski@graeffrobotics.de>
2024-11-20 09:31:15 +01:00
Christian Clason
fd57f39766 vim-patch:4927dae: runtime(compiler): fix escaping of arguments passed to :CompilerSet
See newly added help entry referring to option-backslash

closes: vim/vim#16084

4927daef60

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2024-11-20 09:27:36 +01:00
zeertzjq
ac7e0ff32f
fix(move): redraw for 'concealcursor' after changing w_wcol (#31276) 2024-11-20 08:24:58 +08:00
Tomasz N
f111c32ff9
fix(messages): no message kind for search pattern #31272 2024-11-19 16:06:36 -08:00
Lewis Russell
081beb3659 fix(lsp): restore get_language_id behaviour
Ensure filetype is always passed.

Fixes #31262
2024-11-19 12:19:05 +00:00
zeertzjq
0183c32474
vim-patch:9.1.0870: too many strlen() calls in eval.c (#31267)
Problem:  too many strlen() calls in eval.c
Solution: Refactor eval.c to remove calls to STRLEN()
          (John Marriott)

closes: vim/vim#16066

bd4614f43d

Co-authored-by: John Marriott <basilisk@internode.on.net>
2024-11-19 11:03:29 +00:00
Christian Clason
c12be1249f vim-patch:9.1.0873: filetype: Vivado files are not recognized
Problem:  filetype: Vivado files are not recognized
Solution: detect '*.mss' files as 'mss' filetype
          (Wu, Zhenyu)

references:
https://docs.amd.com/r/2020.2-English/ug1400-vitis-embedded/Microprocessor-Software-Specification-MSS

closes: vim/vim#15907

a87462a498

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-11-19 10:44:30 +01:00
Lewis Russell
989a37a594 refactor(lsp): fold in dynamic_registration code into the client
Problem:

Capability register logic is spread across 3 files.

Solution:

- Consolidate (and simplify) logic into the client.
- Teach client.supports_method about resolve methods
2024-11-18 17:09:53 +00:00
altermo
e2ad251c8d
fix(api): nvim_get_option_value does not clean up on FileType error #31219
Problem:
If there's an error in `FileType` autocmd, the filetype get-opt buffer
doesn't get cleaned up.

Solution:
Call `aucmd_restbuf`.
2024-11-18 06:40:51 -08:00
luukvbaal
40347f6e27
fix(api): only flush nvim__redraw when necessary #31250
Problem:  Not possible to only set a "redraw later" type with
          nvim__redraw, which seems to be desired for the
          treesitter highlighter.
Solution: Do not update the screen when "flush" is explicitly set to
          false and only redraw later types are present. In that case,
          do not call ui_flush() either.
2024-11-18 06:35:21 -08:00
zeertzjq
1763eddede
vim-patch:9.1.0869: Problem: curswant not set on gm in folded line (#31247)
Problem:  curswant not set on gm in folded line
          (citizenmatt)
Solution: in a folded line, call update_curswant_force()

fixes: vim/vim#11596
closes: vim/vim#11994
closes: vim/vim#15398

9848face74

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-11-18 09:52:11 +08:00
Yochem van Rosmalen
965dc81f81
fix(checkhealth): disable 'listchars' #31245
Problem:
'listchars' (in particular multispace) breaks visual heading due to
`Whitespace` highlight group.

Solution:
Disable 'list' (and thus all listchars) by default for `checkhealth`
files.

Fixes #31145
2024-11-17 15:33:34 -08:00
Peter Aronoff
cc6992f1ca
feat(defaults): dot-repeat [<Space> #31186
Problem: `[<Space>` and `]<Space>` do not support repetition.

Solution: use `operatorfunc` and `g@l` to make these mappings dot
repeatable.
2024-11-17 13:31:24 -08:00
Riley Bruins
44229bb85b
feat(lsp): highlight hover target/range #31110
**Problem:** Despite the LSP providing the option for language servers
to specify a range with a hover response (for highlighting), Neovim does
not give the option to highlight this range.

**Solution:** Add an option to `buf.hover()` which causes this range to
be highlighted.

Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
2024-11-17 12:31:32 -08:00
luukvbaal
235cb5bc5f
fix(api): update "range" windows in nvim__redraw #31042
Problem:  nvim__redraw's "range" marks a buffer range for redraw, and subsequently
          flushes the UI without updating the windows containing that buffer.
Solution: Implicitly update the screen, unless specified otherwise.
          Only update the screen with the last call of the treesitter
          on_changedtree() callback.
2024-11-17 11:43:36 -08:00
luukvbaal
e025f5a5b3
fix(messages): proper multiline Lua print() messages #31205
Problem:  Separate message emitted for each newline present in Lua
          print() arguments.
Solution: Make msg_multiline() handle NUL bytes. Refactor print() to use
          msg_multiline(). Refactor vim.print() to use print().
2024-11-17 10:21:50 -08:00
luukvbaal
6ea45031d5
fix(api): nvim_echo free text memory with invalid highlight (#31243)
Fix regression from #31195
2024-11-17 22:06:44 +08:00
Christian Clason
10beeee06f build(deps): bump uncrustify to uncrustify-0.80.1 2024-11-17 14:09:26 +01:00
Maria José Solano
38838fb00a
fix(lsp): type-errors, other nits in vim.lsp.log #31235 2024-11-16 18:32:09 -08:00
luukvbaal
cdc9baeaf8
fix(treesitter): remove redundant on_bytes callback #31041
Problem:  Treesitter highlighter implements an on_bytes callback that
          just re-marks a buffer range for redraw. The edit that
          prompted the callback will already have done that.
Solution: Remove redundant on_bytes callback from the treesitter
          highlighter module.
2024-11-16 16:25:10 -08:00
luukvbaal
9c718bc2bc
fix(api): validation, documentation of hl_group #31195
Problem:  Documentation for "hl_group" in nvim_buf_set_extmark() is
          unclear. "hl_group" in nvim_echo() does not accept
          highlight group id.
Solution: Move documentation for highlight group name/id to first
          mention of hl_group. Update nvim_echo() to accept highlight
          group id.
2024-11-16 15:36:11 -08:00
luukvbaal
f85bc41c80
feat(ui): don't show unfocusable windows in :tabs, 'tabline' #27984
Problem:  Floating windows with focusable set to false can reasonably be
          expected to be UI elements but are listed in some outputs that
          should contain only regular windows.
Solution: Hide unfocusable floating windows from the default tabline and
          :tabs.
2024-11-16 15:32:36 -08:00
Famiu Haque
29ded88957
refactor(options): remove .indir, redesign option scopes #31066
Problem:
The way option scopes currently work is inflexible and does not allow for nested
option scopes or easily finding the value of an option at any arbitrary scope
without having to do long handwritten switch-case statements like in
`get_varp()`. `.indir` is also confusing and redundant since option indices for
each scope can be autogenerated.

Solution:
Expand option scopes in such a way that an option can support any amount of
scopes using a set of scope flags, similarly to how it's already done for option
types. Also make options contain information about its index at each scope it
supports. This allows for massively simplifying `get_varp()` and
`get_varp_scope()` in the future by just using a struct for options at each
scope. This would be done by creating a table that stores the offset of an
option's variable at a scope by using the option's index at that scope as a key.
This PR also autogenerates enums for option indices at each scope to remove the
need for `.indir` entirely, and also to allow easily iterating over options all
options that support any scope.

Ref: #29314
2024-11-16 12:56:16 -08:00
Christian Clason
be8648f345 build(deps): bump uncrustify to uncrustify-0.80.0 2024-11-16 15:42:55 +01:00
zeertzjq
f164e1e35c
vim-patch:partial:9.1.0851: too many strlen() calls in getchar.c (#31230)
Problem:  too many strlen() calls in getchar.c
Solution: refactor code and reduce strlen() calls
          (John Marriott)

closes: vim/vim#16017

e7a1bbf210

Co-authored-by: John Marriott <basilisk@internode.on.net>
2024-11-16 09:55:41 +08:00
errael
2f7b0018b0
docs: standardize doc for ChanInfo/ChanOpen autocmds/v:event (#31099) 2024-11-16 09:37:36 +08:00
zeertzjq
2eb227f5b6
test(lua/ui_event_spec): avoid polluting log file (#31229) 2024-11-16 08:56:42 +08:00
zeertzjq
fbbb9d6f7b
vim-patch:9.1.0866: filetype: LLVM IR files are not recognized (#31228)
Problem:  filetype: LLVM IR files are not recognized
Solution: detect '*.ll' files either as lifelines or llvm filetype
          (Wu, Zhenyu)

closes: vim/vim#15824

bc32bbddcf

N/A patch:
vim-patch:7e4b861: runtime(filetype): remove duplicated *.org file pattern

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-11-16 00:42:12 +00:00
luukvbaal
6e4df18b45
fix(ui): no fast context for prompt message kinds #31224
Problem:  No longer able to show prompt messages with vim.ui_attach().
Solution: Do not execute callback in fast context for prompt message
          kinds. These events must be safe to show the incoming message
          so the event itself serves to indicate that the message
          should be shown immediately.
2024-11-15 14:34:42 -08:00
Yi Ming
f1748b78e3
feat(default): bind vim.lsp.buf.signature_help in select mode (#31223) 2024-11-15 10:13:41 -06:00
Christian Clason
c33ec2d7ce vim-patch:7c3b65e: runtime(cfg): only consider leading // as starting a comment
fixes: vim/vim#16051

7c3b65eb3e

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-11-15 09:32:15 +01:00
Christian Clason
a785be9cc7 vim-patch:0acd3ab: runtime(sh): better function support for bash/zsh in indent script
closes: vim/vim#16052

0acd3abfad

Co-authored-by: Lukas Zapletal <lzap+git@redhat.com>
2024-11-15 09:32:15 +01:00
Christian Clason
c9045f5ba3 vim-patch:460799d: runtime(netrw): small fixes to netrw#BrowseX
- do not enter dir in Netrw on opening
- double quotes after start cause error on Windows

See @chrisbra 's comments at
[0]

[0]: ff82e7a9db (diff-39baf27d8f62071617bbef12f874cce31c0ebd02ec99e7b119474ca870c636a3R5279)

460799d885

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2024-11-15 09:32:15 +01:00
Christian Clason
f0fd9acc4b vim-patch:9.1.0865: filetype: org files are not recognized
Problem:  filetype: org files are not recognized
Solution: detect '*.org' files as 'org' filetype,
          include filetype and syntax plugin
          (Luca Saccarola)

closes: vim/vim#16054

0684800c85

Co-authored-by: Luca Saccarola <github.e41mv@aleeas.com>
2024-11-15 09:07:37 +01:00
Christian Clason
2024c10d74
ci(win): remove python workaround (#31212)
Explicitly installing Python 3.13 using (deprecated version of) `setup-python` looks to be no longer required for provider tests to pass.
2024-11-15 08:47:22 +01:00
Hyker
6ef80eb42c
fix(treesitter): keep treeview open if source window is still open #31198
Problem: When there is a tree view opened by :InspectTree and the
source buffer is open in multiple windows, closing one of the source
windows will lead to the tree view being closed as well.
Regression by #31181.

Solution: Check how many source windows are open when trying to
quit one. If there are more than one, keep the tree view(s) open.
If the only source window is closed, also close the tree view(s).

fix #31196
2024-11-14 19:00:18 -08:00
zeertzjq
54c85bcb6d
vim-patch:9.1.0855: setting 'cmdheight' may missing output (#31216)
Problem:  setting 'cmdheight' may cause hit-enter-prompt and echo output
          to be missing
Solution: Before cleaning the cmdline, check the need_wait_return flag
          (nwounkn)

closes: vim/vim#13432

2e48567007

Co-authored-by: nwounkn <nwounkn@gmail.com>
2024-11-15 00:18:53 +00:00
zeertzjq
fa0dcde3d9
vim-patch:9.1.0864: message history is fixed to 200 (#31215)
Problem:  message history is fixed to 200
Solution: Add the 'msghistory' option, increase the default
          value to 500 (Shougo Matsushita)

closes: vim/vim#16048

4bd9b2b246

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Co-authored-by: Milly <milly.ca@gmail.com>
2024-11-15 08:04:49 +08:00
bfredl
05d354e216
Merge pull request #27874 from luukvbaal/funcerr
fix(messages)!: vim.ui_attach message callbacks are unsafe
2024-11-14 18:56:56 +01:00
Christian Clason
434d5936b6 build(deps): bump luajit to HEAD - fe71d0fb5 2024-11-14 18:00:30 +01:00
Lewis Russell
d3e4ffafff feat(lsp): support utf-8 and utf-32 position encodings
Resolves #30034
2024-11-14 15:32:49 +00:00
Luuk van Baal
de48fbbd5f fix(messages)!: vim.ui_attach message callbacks are unsafe
Problem:  Lua callbacks for "msg_show" events with vim.ui_attach() are
          executed when it is not safe.
Solution: Disallow non-fast API calls for "msg_show" event callbacks.
          Automatically detach callback after excessive errors.
          Make sure fast APIs do not modify Nvim state.
2024-11-14 13:23:11 +01:00
bfredl
7d771c3eee
Merge pull request #31168 from bfredl/noattach
fix(tests): needing two calls to setup a screen is cringe
2024-11-14 13:10:32 +01:00