Commit Graph

26306 Commits

Author SHA1 Message Date
Mathias Fußenegger
134b9ec483
feat(lsp): soft deprecate vim.lsp.for_each_buffer_client (#24104)
There is no need for two ways to access all clients of a buffer.

This doesn't add a `vim.deprecate` call yet, as the function is probably
used a lot, but removes it from the documentation and annotates it with
`@deprecated`
2023-06-22 13:54:35 +02:00
Justin M. Keyes
2f17ef1fc4
fix(messages): use "Vimscript" instead of "VimL" #24111
followup to #24109
fix #16150
2023-06-22 04:09:14 -07:00
Justin M. Keyes
4e6356559c
test: spellcheck :help (vimdoc) files #24109
Enforce consistent terminology (defined in
`gen_help_html.lua:spell_dict`) for common misspellings.

This does not spellcheck English in general (perhaps a future TODO,
though it may be noisy).
2023-06-22 03:44:51 -07:00
zeertzjq
f4f1ce1d16
fix(extmarks): hide inline virt_text properly with 'smoothscroll' (#24106) 2023-06-22 18:15:04 +08:00
zeertzjq
958cc22836
fix(extmarks): empty inline virt_text interfering with DiffText (#24101) 2023-06-22 17:48:53 +08:00
Justin M. Keyes
130b8c801a
Merge #24087 from justinmk/doc
docs: lsp, fix errors, gen_help_html features
2023-06-22 01:51:20 -07:00
Mathias Fußenegger
4d3a04279d
perf(lsp): remove grouping logic from lsp.status (#24096)
With the title carry-over logic in the `$/progress` handler it's not
necessary to group again in vim.lsp.status
2023-06-22 10:18:49 +02:00
Justin M. Keyes
b0cf9c5fee feat(gen_help_html): ignore pi_netrw.txt errors
IDGAF about netrw
2023-06-22 10:18:24 +02:00
Justin M. Keyes
81d8fce8f9 feat(gen_help_html): non-default vimdoc.so parser
Callers can specify a non-default vimdoc.so file path.
2023-06-22 10:18:24 +02:00
Justin M. Keyes
d931b829e9 fix(docs): vimdoc syntax errors
Since https://github.com/neovim/tree-sitter-vimdoc/pull/97
the many cases of *.foo cause parser errors. But even before that, these
were erroneously highlighted as (argument), so fixing them is good.
2023-06-22 10:18:24 +02:00
Justin M. Keyes
5c73b1bb4c docs: lsp, vim_diff
- quickstart
- mark lsp.txt as `new_layout`
- remove lsp-handler documentation for notifications: they don't have
  handlers because they don't have server responses.
2023-06-22 10:18:17 +02:00
zeertzjq
a41883bfbe
Merge pull request #24098 from zeertzjq/fix-extmark
Fix two extmark bugs
2023-06-22 15:37:32 +08:00
Julian Grinblat
43e76cc346
fix: tostring(vim.version()) fails if build is NIL #24097
Problem:
Since #23925, Version.build may be vim.NIL, which causes tostring() to fail:
    E5108: Error executing lua E5114: Error while converting print argument #1: …/version.lua:129:
    attempt to concatenate field 'build' (a userdata value)
    stack traceback:
            [C]: in function 'print'
            [string ":lua"]:1: in main chunk

Solution:
Handle vim.NIL in Version:__tostring().
2023-06-22 00:36:38 -07:00
zeertzjq
a9cd8467cb fix(api): wrong nvim_buf_set_extmark error for invalid hl_mode 2023-06-22 15:04:46 +08:00
zeertzjq
0534ad8ca5 fix(extmarks): empty inline virt_text interfering with Visual highlight 2023-06-22 15:04:46 +08:00
Gregory Anders
08db61b19b
feat(man): respect 'wrapmargin' when wrapping man pages (#24091) 2023-06-21 14:42:23 -05:00
Justin M. Keyes
e27377e33e
Merge #24086 LSP ctx.version, report full Nvim version 2023-06-21 03:36:39 -07:00
Justin M. Keyes
59048814fd docs(lsp): mention ctx.version
Since 643546b82b the request handler
context (`ctx`) includes a `version` field.
2023-06-21 12:32:54 +02:00
zeertzjq
ded01a819a
fix(folds): don't show search or match highlighting on fold (#24084) 2023-06-21 18:28:12 +08:00
Justin M. Keyes
21b074feb0 refactor(lsp): report full Nvim version string in clientInfo 2023-06-21 12:16:26 +02:00
Justin M. Keyes
8d4a53fe6e
fix(vim.json)!: remove global options, "null", "array_mt" #24070
Problem:
- `vim.json` exposes various global options which:
  - affect all Nvim Lua plugins (especially the LSP client)
  - are undocumented and untested
  - can cause confusing problems such as: cc76ae3abe
- `vim.json` exposes redundant mechanisms:
  - `vim.json.null` is redundant with `vim.NIL`.
  - `array_mt` is redundant because Nvim uses a metatable
    (`vim.empty_dict()`) for empty dict instead, which `vim.json` is
    configured to use by default (see `as_empty_dict`).
    Example:
    ```
    :lua vim.print(vim.json.decode('{"bar":[],"foo":{}}'))
    --> { bar = {},  foo = vim.empty_dict() }
    ```
    Thus we don't need to also decorate empty arrays with `array_mt`.

Solution:
Remove the functions from the public vim.json interface.
Comment-out the implementation code to minimize drift from upstream.

TODO:
- Expose the options as arguments to `vim.json.new()`
2023-06-21 01:10:32 -07:00
Akin
e42fdaad21
fix(lsp): add spacing for inlay hints separately #24079
Problem:
Spacing around inlay hints has the same highlight as the hint itself.
The LSP spec for inlay hints specifically mentions the padding should not be
coloured:

    /**
    Render padding before the hint.
    Note: Padding should use the editor's background color, not the
    background color of the hint itself. That means padding can be used
    to visually align/separate an inlay hint.
    */
    paddingLeft?: boolean;
    /**
    Render padding after the hint.
    Note: Padding should use the editor's background color, not the
    background color of the hint itself. That means padding can be used
    to visually align/separate an inlay hint.
    */
    paddingRight?: boolean;

Solution:
Add the space as separate parts of the virtual text, don't add the space to the
text itself.
2023-06-21 00:55:19 -07:00
Chinmay Dalal
1b679ac192
fix(lsp): define LspInlayHint highlight group #24073
fixes #24068

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2023-06-21 00:33:56 -07:00
Sooryakiran Ponnath
3bf887f6e0
fix(lsp): always return boolean in lsp.buf_client_attach (#24077)
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
2023-06-20 21:17:13 +02:00
bfredl
1f0b2dc6cd
Merge pull request #24069 from famiu/refactor/options/varp
refactor(option): use `void *` for pointer to option value
2023-06-20 19:33:11 +02:00
Chinmay Dalal
d3e0352574
fix(lsp): check if inlay hints are enabled for a buffer before disabling (#24074)
disabling before enabling throws an error otherwise, because bufstate[bufnr]
doesn't exist
2023-06-20 18:36:31 +02:00
Mathias Fußenegger
64f2691a98
refactor(lsp): extract common execute command functionality (#24065) 2023-06-20 18:36:18 +02:00
Famiu Haque
3681b7bb3b refactor(option): use void * for pointer to option value
Option related code uses `char *` for pointer to option value, which is not the best way of representing a type-agnostic pointer.

Solution: Make pointers to option value use `void *` instead.
2023-06-20 20:38:15 +06:00
Chinmay Dalal
19eef8156b
docs(lsp): LspInlayHint highlight group #24071 2023-06-20 03:20:17 -07:00
Chinmay Dalal
96b94f8d77
fix(lsp): duplicate on_detach, on_reload callbacks #24067
M.enable already clears bufstate[bufnr] and the namespace,
the duplicate callbacks cause an error (indexing bufstate[bufnr] fails)
2023-06-20 02:36:06 -07:00
Chinmay Dalal
ca5de9306c
feat(lsp): inlay hints #23984
Add automatic refresh and a public interface on top of #23736

 * add on_reload, on_detach handlers in `enable()` buf_attach, and
  LspDetach autocommand in case of manual detach
* unify `__buffers` and `hint_cache_by_buf`
* use callback bufnr in `on_lines` callback, bufstate: remove __index override
* move user-facing functions into vim.lsp.buf, unify enable/disable/toggle

Closes #18086
2023-06-19 23:06:54 -07:00
Justin M. Keyes
72a6643b13
docs #24061
- nvim requires rpc responses in reverse order. https://github.com/neovim/neovim/issues/19932
- NVIM_APPNAME: UIs normally should NOT set this.

ref #23520
fix #24050
fix #23660
fix #23353
fix #23337
fix #22213
fix #19161
fix #18088
fix #20693
2023-06-19 08:40:33 -07:00
bfredl
91f57723ad
Merge pull request #24063 from bfredl/ceci-nest-pas-rtp
fix(docs): the runtimepath is not the runtime path
2023-06-19 16:14:28 +02:00
bfredl
0d149bb186 fix(docs): the runtimepath is not the runtime path 2023-06-19 14:43:36 +02:00
Gregory Anders
dcf8a71b85
docs: deprecation policy #23138 2023-06-19 03:43:32 -07:00
Justin M. Keyes
cee981bf09
docs #22363
Co-authored by: zeertzjq <zeertzjq@outlook.com>
Co-authored by: Steven Todd McIntyre II <114119064+stmii@users.noreply.github.com>
Co-authored by: nobe4 <nobe4@users.noreply.github.com>

- docs: mention --luadev-mod to run with lua runtime files
  When changing a lua file in the ./runtime folder, a new contributor
  might expect changes to be applied to the built Neovim binary.
2023-06-19 02:24:44 -07:00
Santos Gallegos
8c9dab3e0d
fix(treesitter): use vim.highlight.priorities instead of hardcoded 100 (#24052)
Problem: Treesitter highlighting base priority cannot be customized.

Solution: Use `vim.highlight.priorities.treesitter` instead of hard-coded value.
2023-06-18 16:42:17 +02:00
Evgeni Chasnovski
8a7e3353eb
fix(fs): make normalize() work with '/' path (#24047)
Problem: Current implementation of "remove trailing /" doesn't
account for the case of literal '/' as path.
Solution: Remove trailing / only if it preceded by something else.

Co-authored by: notomo <notomo.motono@gmail.com>
2023-06-18 06:49:33 -05:00
zeertzjq
7e301ed5b9
vim-patch:9.0.1638: crypt tests hang and cause memory errors (#24053)
Problem:    crypt tests hang and cause memory errors
Solution:   Move variable to start of function.

438d0c5e58

N/A patches for version.c:

vim-patch:9.0.1639: build failure without the crypt feature

Problem:    Build failure without the crypt feature.
Solution:   Adjust #ifdefs

bc385a150f

vim-patch:9.0.1640: compiler warning for unused variables without crypt feature

Problem:    Compiler warning for unused variables without the crypt feature.
Solution:   Adjust #ifdefs

7f29122c8c

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-18 07:08:31 +08:00
Jonas Strittmatter
c07dceba33
fix(lsp): allow Lua pattern chars in code action filter (#24041)
Previously, filtering code actions with the "only" option failed
if the code action kind contained special Lua pattern chars such as "-"
(e.g. the ocaml language server supports a "type-annotate" code action).

Solution: use string comparison instead of string.find
2023-06-17 08:01:31 +02:00
zeertzjq
4e63104c47
vim-patch:9.0.1637: compiler warning for uninitialized variable (#24042)
Problem:    Compiler warning for uninitialized variable.
Solution:   Move the variable to an inner block and initialize it. (Christian
            Brabandt, closes vim/vim#12549)

54f50cbf6a

The "eof" variable is not present in Nvim because it is only used by
FEAT_CRYPT.

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-06-17 06:23:07 +08:00
zeertzjq
8376e8700b
Merge pull request #24037 from zeertzjq/vim-9.0.1634
vim-patch:9.0.{1634,1635}: message is cleared when removing mode message
2023-06-16 09:20:41 +08:00
zeertzjq
11060793d6 vim-patch:9.0.1635: error message is cleared when removing mode message
Problem:    Error message is cleared when removing mode message.
Solution:   Also reset flags when the message is further down.

da51ad51bf

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-16 08:55:05 +08:00
zeertzjq
cba07dad49 vim-patch:9.0.1634: message is cleared when removing mode message
Problem:    Message is cleared when removing mode message (Gary Johnson).
Solution:   Do not clear the command line after displaying a message.

800cdbb7ca

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-16 08:55:03 +08:00
zeertzjq
ddba917efe
vim-patch:9.0.1636: expanding a pattern interferes with cmdline completion (#24034)
Problem:    Expanding a pattern interferes with command line completion.
Solution:   Set the file index only when appropriate. (closes vim/vim#12519)

094dd152fe
2023-06-16 07:02:21 +08:00
zeertzjq
1f8fb7c000
fix(:let): fix error when applying operator to boolean option (#24030) 2023-06-15 12:36:21 +08:00
zeertzjq
d81f78713b
test(decorations_spec): add test for extmark case of #21486 (#24028) 2023-06-15 11:14:50 +08:00
zeertzjq
a05bbc60ea
fix(extmarks): don't position overlay virt_text halfway a char (#24027) 2023-06-15 09:03:39 +08:00
zeertzjq
78d77c03de
vim-patch:9.0.1631: passing wrong variable type to option gives multiple errors (#24026)
Problem:    Passing a wrong variable type to an option gives multiple errors.
Solution:   Bail out early on failure. (closes vim/vim#12504)

4c7cb372c1
2023-06-15 08:05:26 +08:00
Erich Gubler
cf6cffda89
docs(ex_cmds): migration from "behave xterm" #24024 2023-06-14 15:23:15 -07:00