Commit Graph

28146 Commits

Author SHA1 Message Date
Jongwook Choi
6c35fb421e fix(gen_lsp.lua): improve type name, and fix wrong type inheritance
Style improvements:

1. Anonymous classes derived from `StructureLiteralType` should have a
   better name. The class name can be also nested. Examples:

```diff
----@field serverInfo? anonym1
+---@field serverInfo? lsp._anonym1.serverInfo
```
```diff
----@field insertTextModeSupport? anonym26
+---@field insertTextModeSupport? lsp._anonym26.completionItem.insertTextModeSupport
```

2. Add one separate empty line before each `@field` definition. Without
   these, empty lines the doc can look confusing because descriptions
   also may contain empty lines. See `lsp.CompletionItem` for example:

```lua
---The kind of this completion item. Based of the kind
---an icon is chosen by the editor.
---@field kind? lsp.CompletionItemKind
---Tags for this completion item.
---
---@since 3.15.0
---@field tags? lsp.CompletionItemTag[]
```

   It might feel like "Tags for this completion item" belongs to `kind`,
   not `tags` due to the lack of separator blank lines. The following
   (after this commit) should look much better:

```diff
 ---The kind of this completion item. Based of the kind
 ---an icon is chosen by the editor.
 ---@field kind? lsp.CompletionItemKind
+---
 ---Tags for this completion item.
 ---
 ---@since 3.15.0
 ---@field tags? lsp.CompletionItemTag[]
```

3. Escape some LSP-specific annotations that can't be recognized by
   lua-ls. It'd be better to make them visible in LSP hover doc windows.

   Example: `@sample ...`.

Fixes:

1. A type may extend from more than one base types (as well as mixin
   types). Previously only the first base class was being considered,
   resulting incomplete base classes for `@class` definitions.

   Example: `InlayHintOptions` (should have both of `resolveProvider`
   and `workDoneProgress`, the latter is from `WorkDoneProgressOptions`)

```diff
----@class lsp.InlayHintOptions
+---@class lsp.InlayHintOptions: lsp.WorkDoneProgressOptions
```

2. Remove `<200b>` (zero-width space) unicode characters.

3. Add the missing newline at EOF.
2023-12-27 10:48:06 +01:00
Jongwook Choi
2f43af6423 refactor(gen_lsp.lua): add typing for the LSP protocol JSON data model
Enhance readability and intellisense by incorporating type annotations.
Types are not very strict and may not encompass th entire LSP Protocol
metamodel; the scope is up to what's relevant for generating type
annotations for LSP (`_meta/protocol.lua`).

Based on the model schema:
https://raw.githubusercontent.com/microsoft/language-server-protocol/gh-pages/_specifications/lsp/3.18/metaModel/metaModel.schema.json

No behavioral changes (and hence no diff on _meta/protocol.lua) should
exist in this commit.
2023-12-27 10:48:06 +01:00
Jongwook Choi
3767468b96 docs(gen_lsp.lua): re-generate vim.lsp._meta.protocol type annotations
The purpose of this commit is to make diff clean and easy to read; to
see the diff resulted from actual changes in gen_lsp.lua, not from the
updated LSP protocol JSON data.

Ran: `nvim -l scripts/gen_lsp.lua gen --methods`

Based on 3.18.0 (2023-12-23)
2023-12-27 10:48:06 +01:00
Raphael
382ea4d402
fix(inccommand): don't preview in Ex mode (#26587) 2023-12-27 15:18:22 +08:00
Nacho Nieva
c26dc1f77c
feat(defaults): map Q and @x to repeat in Visual mode (#26495) 2023-12-27 07:26:18 +08:00
dundargoc
5cb906e91c fix: correct versions in deprecation warnings
The following functions should be removed in 0.12 according to the
deprecation strategy in MAINTAIN.md:

- vim.lsp.util.extract_completion_items()
- vim.lsp.util.parse_snippet()
- vim.lsp.util.text_document_completion_list_to_complete_items()
2023-12-27 00:05:36 +01:00
dundargoc
5f9d4d8afe refactor: use vim.deprecate on all deprecated functions 2023-12-27 00:05:36 +01:00
dundargoc
0f22ea400c
ci: disable libintl on mac release
The releases doesn't work on intel mac as libintl isn't available on the system
by default. This makes `:language` not work for the shipped macos releases,
though the reduction in build system complexity most likely outweighs that.
2023-12-26 22:46:10 +01:00
dundargoc
0da50da6e2 ci: remove winget workflow
All releases that aren't directly maintained by us should live in the
`neovim/neovim-releases` repository to make it clear that neovim isn't
directly responsible for it and to correctly manage expectations that
it's provided on a best-effort case.

Closes https://github.com/neovim/neovim/issues/26717.
2023-12-26 21:48:20 +01:00
dundargoc
0009c337bc test: simplify vim.fs tests
The exec_lua wrapper is no longer necessary.
2023-12-26 13:22:43 +01:00
luukvbaal
ec74538044
fix(column): correct width after truncated 'statuscolumn' error (#26737)
Problem:  Default number column has incorrect width after 'statuscolumn'
          is unset due to an error, but was also truncated.
Solution: Reverse 'statuscolumn' error and truncate return branches.
2023-12-26 09:07:58 +08:00
luukvbaal
bbd5c6363c
feat(extmarks): add virt_text_repeat_linebreak flag (#26625)
Problem:  Unable to predict which byte-offset to place virtual text to
          make it repeat visually in the wrapped part of a line.
Solution: Add a flag to nvim_buf_set_extmark() that causes virtual
          text to repeat in wrapped lines.
2023-12-26 07:16:03 +08:00
dundargoc
0a598c13b1 feat(vim.deprecate): only issue warning if neovim version is high enough
As specified by MAINTAIN.md, features should be soft deprecated at first
(meaning no warnings) to give people a chance to adjust. The problem
with this approach is that deprecating a feature becomes harder than
usual as during the soft deprecation period you need to remember not to
issue a warning, and during the hard deprecation period you need to
remember to start issuing a warning.

This behavior is only enforced if the `plugin` parameter is `nil` as
plugins may not want this specific behavior.
2023-12-25 21:20:09 +01:00
bfredl
343436f97d
Merge pull request #25528 from bfredl/nocpolisp
refactor(cpoptions): remove 'p'
2023-12-25 14:29:14 +01:00
bfredl
e8acbc1ade refactor(cpoptions): remove 'p'
Deleting a cpo flag a day keeps the doctor away

We don't need two different ways to indent LISP code
2023-12-25 14:13:52 +01:00
zeertzjq
ddc8dd187d
refactor(drawline): reduce size of wlv.extra[] (#26733)
It's now only used for transchar_hex(), which only needs 11 bytes.
2023-12-25 18:57:55 +08:00
zeertzjq
a42df11786
test(extmarks): improve tests for ui_watched (#26732) 2023-12-25 15:50:58 +08:00
zeertzjq
2877672d70
feat(health): make :checkhealth support more split modifiers (#26731) 2023-12-25 10:21:13 +08:00
Pablo Arias
2ff2785c39
feat(health): checkhealth buffer can show in a split window (#26714)
:checkhealth now respects :vertical and :horizontal.
For example:
  :vertical checkhealth foo bar
will open the healthcheck buffer in a vertical split.
2023-12-25 08:30:56 +08:00
dundargoc
675522af18 build: remove clint checks and style text covered by uncrustify 2023-12-24 20:50:44 +01:00
dundargoc
ab2aad509d refactor: follow style guide 2023-12-24 12:36:59 +01:00
Christian Clason
84f6216130 build(deps): bump luajit to HEAD - c525bcb90 2023-12-24 09:51:10 +01:00
Jaehwang Jung
7fa292c52d fix(treesitter): outdated highlight due to tree with outdated region
Problem:
A region managed by an injected parser may shrink after re-running the
injection query. If the updated region goes out of the range to be
parsed, then the corresponding tree will remain outdated, possibly
retaining the nodes that shouldn't exist anymore. This results in
outdated highlights.

Solution:
Re-parse an invalid tree if its region intersects the range to be
parsed.
2023-12-24 09:47:59 +01:00
zeertzjq
0b66ab42c7
Merge pull request #26642 from famiu/refactor/options/misc
refactor(options): miscellanous refactors
2023-12-24 14:25:08 +08:00
Famiu Haque
4587912527
refactor(options): do bound checking in validate_num_option() 2023-12-24 11:22:26 +06:00
Famiu Haque
547ccc2681
refactor(options): remove side effects from check_num_option_bounds() 2023-12-24 11:22:25 +06:00
dundargoc
eae6727325 refactor: remove os_errmsg and os_msg functions
Instead replace them with fprintf and printf.
2023-12-23 14:00:09 +01:00
Christian Clason
7121241e5c vim-patch:ea9964a36f94
Runtime(fortran): updates to indent, syntax and ftplugin (vim/vim#13752)

* runtime update fortran.vim

Add folding for newer features of Fortran

* Runtime Update fortran.vim

Add indent support for newer features of Fortran

* Runtime Update fortran.vim

Add newer features of Fortran to matchit patterns

ea9964a36f

Co-authored-by: Ajit-Thakkar <142174202+Ajit-Thakkar@users.noreply.github.com>
2023-12-23 12:41:10 +01:00
Christian Clason
373eb7b799 vim-patch:ec97edcbb9f6
runtime(debcontrol): Add loong64 arch (vim/vim#13754)

ec97edcbb9

Co-authored-by: James McCoy <jamessan@jamessan.com>
Co-authored-by: zhangjialing@loongson.cn <zhangjialing@loongson.cn>
2023-12-23 12:41:10 +01:00
zeertzjq
c16d5729b5
refactor: remove CPO_TO_CPO_FLAGS() (#26718)
Just pass p_cpo to replace_termcodes() directly.
This allows removing option_vars.h from keycodes.h, and also avoids the
mistake of passing 0 as cpo_flags.
2023-12-23 15:53:28 +08:00
zeertzjq
3c667d3e0f
fix(mappings): fix mapset() not replacing map with backslash (#26719) 2023-12-23 15:30:44 +08:00
Famiu Haque
8f72987837
refactor(options): use OptIndex for os_idx 2023-12-23 11:09:00 +06:00
Famiu Haque
4d98ec2fa4
refactor(options): move some functions from options.c to option.c 2023-12-23 11:09:00 +06:00
Famiu Haque
1d2af15a95
refactor(options): restructure functions related to key options 2023-12-23 11:09:00 +06:00
zeertzjq
242261d4e7
refactor(IWYU): move evalarg_T to eval_defs.h (#26716) 2023-12-23 08:28:17 +08:00
Jared Baur
0c3d2a7fd9
build(nix): update flake.lock (#26702)
updates nixpkgs version to reflect the removal of nvim-client in the build see https://github.com/NixOS/nixpkgs/pull/274865
2023-12-23 00:50:24 +01:00
luukvbaal
e632396bab
refactor(drawline): avoid storing info to draw 'statuscolumn' (#26712)
We no longer return to the main loop in win_line() to put column
characters on the screen. Simplify and sync statuscolumn drawing
logic with that of statusline.
2023-12-23 06:31:07 +08:00
Lewis Russell
2b0acacb3c fix(decor): allow adding providers during redraw
Fixes: #26652
2023-12-22 20:27:07 +00:00
Michal Liszcz
031088fc0a
fix(lsp): filetype matching to documentSelector in dynamic capabilities (#25425)
Use the get_language_id client option to resolve the filetype when
matching the document selector in a dynamic capability.


Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
2023-12-22 15:03:13 +01:00
zeertzjq
2151e781e4
Merge pull request #26709 from luukvbaal/drawstatuscol 2023-12-22 19:35:26 +08:00
Luuk van Baal
35d98888bd refactor(drawline): simplify draw_statuscol() and remove draw_state references 2023-12-22 12:07:15 +01:00
bfredl
d9d9d94343
Merge pull request #26528 from bfredl/nodrawstate
refactor(drawline): remove LineDrawState and wlv->saved_n_extra
2023-12-22 11:49:06 +01:00
Steven Arcangeli
92204b06e7
refactor(lsp): move glob parsing to util (#26519)
refactor(lsp): move glob parsing to vim.glob

Moving the logic for using vim.lpeg to create a match pattern from a
glob into `vim.glob`. There are several places in the LSP spec that
use globs, and it's very useful to have glob matching as a
generally-available utility.
2023-12-22 11:40:01 +01:00
Mathias Fußenegger
db0ec84fb4
feat(lsp): add type annotations for lsp.util.locations_to_items (#26694)
Problem: luals reported many warnings
Solution: Add type annotations
2023-12-22 11:38:02 +01:00
Christian Clason
19aba5916a
docs(options): add codeblock annotations to options.lua (#26696)
Also consistently remove leading colons in examples

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-12-22 10:55:39 +01:00
bfredl
66ac327db2 refactor(drawline): remove LineDrawState and wlv->saved_n_extra
We do not need an enum to keep track of what place in win_line() we
currently are at. We already have a variable which keeps track where
in the code we currently are (and thus what part of the line we are
currently rendering), it is called the _program counter_. When we need
non-linear or self-referential control-flow anyway for a laugh, we
have a mechanism for that, it is called _function calls_.

Do not "save" and "restore" the wlv->n_extra state every time the
columns are to be drawn. This sort of thing needs to go away. Instead of
setting the n_extra variables and then going to the outer while loop,
the text in the columns can be rendered by just simply putting the text
into the cells of the screen line, right away. Even in nvim this can be
tricky sometimes, luckily we can use function calls to abstract this
logic, which means that this handy data structure called the _call
stack_ is handling saving away state temporarily, and restoring it back
when we need it again.

Lastly, but not least, as we now have direct control how signs
are rendered, these can be stored as schar_T[2] and be directly
put on screen as such.
2023-12-22 10:54:28 +01:00
zeertzjq
ba0fa4fa19
refactor(IWYU): add "private" pragma to more generated headers (#26706)
"export" only prevents IWYU from adding these headers if the headers
that export them are included, while "private" ensures that IWYU never
adds these headers.
2023-12-22 13:32:46 +08:00
zeertzjq
089b934352
refactor(options): generate BV_ and WV_ constants (#26705) 2023-12-22 12:24:23 +08:00
zeertzjq
6700127b30
vim-patch:9.0.2183: Maximum callback depth is not configurable (#26703)
Problem:  Maximum callback depth is not configurable.
Solution: Revert patch 9.0.2103.  Set 'maxfuncdepth' in test.

fixes: vim/vim#13732
closes: vim/vim#13736

fe583b1e59
2023-12-22 10:33:34 +08:00
zeertzjq
2b3d1e1854
vim-patch:0630080bbd3e (#26704)
runtime(doc): reformat and align :h ft-c-syntax (vim/vim#13738)

0630080bbd

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-12-22 08:58:51 +08:00