Graf commitů

29470 Commity

Autor SHA1 Zpráva Datum
Mathias Fußenegger 9b8a075539
fix(lsp): change `silent` in lsp.start.Opts to optional (#28524) 2024-04-26 20:26:21 +02:00
Gregory Anders 73034611c2
feat(diagnostic): add default mappings for diagnostics (#16230) 2024-04-26 13:16:12 -05:00
Brian Cao 3a7c30dc93
fix(man.vim): q quits after jump to different tag in MANPAGER modified (#28495) 2024-04-26 13:14:45 -05:00
Gregory Anders 6888607415
feat(lsp): add more LSP defaults (#28500)
- crn for rename
- crr for code actions
- gr for references
- <C-S> (in Insert mode) for signature help
2024-04-26 11:12:49 -05:00
Justin M. Keyes 9b028bd64f
refactor(vim.iter)!: rename xxback() => rxx() #28503
Problem:
vim.iter has both `rfind()` and various `*back()` methods, which work
in "reverse" or "backwards" order. It's inconsistent to have both kinds
of names, and "back" is fairly uncommon (rust) compared to python
(rfind, rstrip, rsplit, …).

Solution:
- Remove `nthback()` and let `nth()` take a negative index.
  - Because `rnth()` looks pretty obscure, and because it's intuitive
    for a function named `nth()` to take negative indexes.
- Rename `xxback()` methods to `rxx()`.
  - This informally groups the "list-iterator" functions under a common
    `r` prefix, which helps discoverability.
- Rename `peekback()` to `pop()`, in duality with the existing `peek`.
2024-04-26 08:43:29 -07:00
Lewis Russell b2c26a875b fix(lsp): ensure buffer is not attached more than once
Fixes regression introduced in #28030

If an LSP server is restarted, then the associated `nvim_buf_attach`
call will not detach if no buffer changes are sent between the client
stopping and a new one being created. This leads to `nvim_buf_attach`
being called multiple times for the same buffer, which then leads to
changetracking sending duplicate requests to the server (one per
attach).

To solve this, introduce separate tracking (client agnostic) on which
buffers have had calls to `nvim_buf_attach`.
2024-04-26 16:21:37 +01:00
Lewis Russell b8273c9a33 fix: lua annotations 2024-04-26 15:13:06 +01:00
TheLeoP c5b9fb2f25 fix(treesitter.foldexpr): check for all insert submodes 2024-04-26 15:07:10 +01:00
Gregory Anders 37d8e50459
fix(lsp): add "silent" option to vim.lsp.start (#28478)
vim.notify cannot be suppressed and it is not always necessary to
display a visible warning to the user if the RPC process fails to start.
For instance, a user may have the same LSP configuration across systems,
some of which may not have all of the LSP server executables installed.
In that case, the user receives a notification every time a file is
opened that they cannot suppress.

Instead of using vim.notify in vim.lsp.rpc, propagate a normal error up
through the call stack and use vim.notify in vim.lsp.start() only if
the "silent" option is not set.

This also updates lsp.start_client() to return an error message as its
second return value if an error occurred, rather than calling vim.notify
directly. Callers of lsp.start_client() will need to update call sites
appropriately if they wish to report errors to the user (or even better,
switch to vim.lsp.start).
2024-04-26 08:15:44 -05:00
Yi Ming 567f8a300b
refactor(lsp): rename foos_by_bar to bar_foos #28505 2024-04-26 04:25:55 -07:00
Mathias Fußenegger 47dbda97d2
fix(lsp): buffer messages until connected to server (#28507)
`handle:write(msg)` can fail if the socket is not yet connected to the
server.

Should address https://github.com/neovim/neovim/pull/28398#issuecomment-2078152491
2024-04-26 09:57:59 +02:00
zeertzjq a736e845a4
vim-patch:partial:9.1.0373: ops.c code uses too many strlen() calls (#28508)
Problem:  ops.c code uses too many strlen() calls
Solution: Refactor code and remove more strlen() calls
          (John Marriott)

closes: vim/vim#14598

38b9f45253

Co-authored-by: John Marriott <basilisk@internode.on.net>
2024-04-26 07:18:50 +08:00
Christian Clason d855c7a2fb vim-patch:98b12ede3175
runtime(asm): fix undefined variable in indent plugin

It's an indent script, so we need to set the  b:undo_indent variable
instead of the b:undo_ftplugin var.

fixes: vim/vim#14602

98b12ede31

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-04-25 23:46:46 +02:00
Raphael af8500af64
fix(completion): improve popup window position (#26739) 2024-04-25 21:36:18 +08:00
Gregory Anders b13e63db1d
feat(diagnostic): goto functions jump to highest severity (#28490)
When the "severity" option is nil, vim.diagnostic.goto_next() and
vim.diagnostic.goto_prev() jump to the next diagnostic with the highest
severity.
2024-04-25 08:07:44 -05:00
Justin M. Keyes e0d92b9cc2
fix(vim.ui)!: change open() to return pcall-like values #28502
Problem:
`vim.ui.open` unnecessarily invents a different success/failure
convention. Its return type was changed in 57adf8c6e0, so we might as
well change it to have a more conventional form.

Solution:
Change the signature to use the `pcall` convention of `status, result`.
2024-04-25 04:15:58 -07:00
dundargoc a1c2da56ec build: do not use GIT_REPOSITORY for local dependencies
This reverts a large portion of
2c1e8f7e96.

The conclusion from that commit is incorrect: local builds are not
used/updated correctly so much as it's not used at all. Instead the
build will always use `master` branch rather than the current files.
2024-04-25 11:17:54 +02:00
bfredl 2b9df3f795
Merge pull request #28492 from bfredl/hotfix
fix(lua): vim.fn.has('nvim-0.10') in fast context, used by vim.deprecate
2024-04-25 08:58:58 +02:00
bfredl 1294e221a2 fix(lua): vim.fn.has('nvim-0.10') in fast context, used by vim.deprecate 2024-04-25 08:37:18 +02:00
Christian Clason 30374db955 vim-patch:a4c085a3e607
runtime(java): Improve the recognition of the "style" method declarations

- Request the new regexp engine (v7.3.970) for [:upper:] and
  [:lower:].

- Recognise declarations of in-line annotated methods.

- Recognise declarations of _strictfp_ methods.

- Establish partial order for method modifiers as shown in
  the MethodModifier production; namely, _public_ and
  friends should be written the leftmost, possibly followed
  by _abstract_ or _default_, or possibly followed by other
  modifiers.

- Stop looking for parameterisable primitive types (void<?>,
  int<Object>, etc., are malformed).

- Stop looking for arrays of _void_.

- Acknowledge the prevailing convention for method names to
  begin with a small letter and for class/interface names to
  begin with a capital letter; and, therefore, desist from
  claiming declarations of enum constants and constructors
  with javaFuncDef.
  Rationale:
    + Constructor is distinct from method:
      * its (overloaded) name is not arbitrary;
      * its return type is implicit;
      * its _throws_ clause depends on indirect vagaries of
        instance (variable) initialisers;
      * its invocation makes other constructors of its type
        hierarchy invoked one by one, concluding with the
        primordial constructor;
      * its explicit invocation, via _this_ or _super_, can
        only appear as the first statement in a constructor
        (not anymore, see JEP 447); else, its _super_ call
        cannot appear in constructors of _record_ or _enum_;
        and neither invocation is allowed for the primordial
        constructor;
      * it is not a member of its class, like initialisers,
        and is never inherited;
      * it is never _abstract_ or _native_.
    + Constructor declarations tend to be few in number and
      merit visual recognition from method declarations.
    + Enum constants define a fixed set of type instances
      and more resemble class variable initialisers.

Note that the code duplicated for @javaFuncParams is written
keeping in mind for g:java_highlight_functions a pending 3rd
variant, which would require none of the :syn-cluster added
groups.

closes: vim/vim#14620

a4c085a3e6

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2024-04-25 08:23:39 +02:00
Gregory Anders 38b9c322c9
feat(fs): add vim.fs.root (#28477)
vim.fs.root() is a function for finding a project root relative to a
buffer using one or more "root markers". This is useful for LSP and
could be useful for other "projects" designs, as well as for any plugins
which work with a "projects" concept.
2024-04-24 21:43:46 -05:00
Will Hopkins 16513b3033
feat(api): allow floats to be opened in non-current tabpage (#28480)
\
2024-04-25 09:14:05 +08:00
zeertzjq c32fcd1ed5
refactor(source): remove unnecessary concatenation with Lua (#28499) 2024-04-25 08:26:49 +08:00
Mathias Fußenegger 7f084770c2
perf(diagnostic): avoid table copies to filter by severity (#28491)
Instead of adding all diagnostics matching lnum filters to a table, and
then copying that table to another table while applying the severity
filter, this changes the flow to only add diagnostics matching both
filters in the first pass.
2024-04-24 21:47:02 +02:00
dundargoc a1550dbf0a build: silence new clang-tidy warnings 2024-04-24 10:28:55 +02:00
zeertzjq 7d28c427e3
vim-patch:8.2.2332: Vim9: missing :endif not reported when using :windo (#28482)
Problem:    Vim9: missing :endif not reported when using :windo.
Solution:   Pass a getline function to do_cmdline(). (closes vim/vim#7650)

9567efa1b4

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-04-24 13:30:57 +08:00
Mathias Fußenegger c81b7849a0
refactor(lsp): merge subtypes and supertypes into typehierarchy (#28467)
Both methods had pretty much the same documentation and shared the
implementation.
2024-04-23 19:05:01 +02:00
dundargoc 052498ed42 test: improve test conventions
Specifically, functions that are run in the context of the test runner
are put in module `test/testutil.lua` while the functions that are run
in the context of the test session are put in
`test/functional/testnvim.lua`.

Closes https://github.com/neovim/neovim/issues/27004.
2024-04-23 18:17:04 +02:00
Evgeni Chasnovski c5af5c0b9a
perf(lua): faster vim.deprecate() #28470
Problem: `vim.deprecate()` can be relatively significantly slower than
  the deprecated function in "Nvim" plugin.
Solution: Optimize checks for "Nvim" plugin. This also results into not
  distinguishing "xxx-dev" and "xxx" versions when doing checks, which
  is essentially covered by the deprecation logic itself.

With this rewrite I get the times from #28459: `{ 0.024827, 0.003797, 0.002024, 0.001774, 0.001703 }`.
For quicker reference:
    -  On current Nightly it is something like `{ 3.72243, 0.918169, 0.968143, 0.763256, 0.783424 }`.
    - On 0.9.5: `{ 0.002955, 0.000361, 0.000281, 0.000251, 0.00019 }`.
2024-04-23 08:23:45 -07:00
Raphael a4fc3bb0e6
fix(diagnostic): vim.diagnostic.get(…,{lnum=…}) on multi-line diagnostic #28273
Problem:
vim.diagnostic.get(…,{lnum=…}) does not match multi-line diagnostics.

Solution: add end_lnum support.
2024-04-23 04:13:58 -07:00
Raphael ad76b050eb
fix(diagnostic): open_float on multi-line diagnostics #28301
Problem: when diagnostic have a range of line, open_float not work.

Solution: filter diagnostic by line number range.
2024-04-23 04:06:41 -07:00
Christian Clason aef120d1e9 vim-patch:9.1.0366: filetype: ondir files are not recognized
Problem:  filetype: ondir files are not recognized
Solution: Detect '.ondirrc' as ondir filetype
          (Jon Parise)

closes: vim/vim#14604

ea999037a4

Co-authored-by: Jon Parise <jon@indelible.org>
2024-04-23 09:38:46 +02:00
zeertzjq 3305bb9e41
vim-patch:9.1.0364: tests: test_vim9_builtin is a bit slow (#28466)
Problem:  tests: test_vim9_builtin is a bit slow
Solution: source tests from a buffer instead of
          writing and sourcing a file (Yegappan Lakshmanan)

closes: vim/vim#14614

22697b6179

N/A patch:
vim-patch:9.1.0299: Vim9: return type not set for a lambda assigned to script var

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-04-23 08:28:51 +08:00
zeertzjq 7508f1e607
vim-patch:f7a38650eaf6 (#28465)
runtime(doc): update documentation

closes: vim/vim#14616

f7a38650ea

Co-authored-by: RestorerZ <restorer@mail2k.ru>
2024-04-23 08:20:36 +08:00
zeertzjq d0ab67410c
vim-patch:9.1.0365: Crash when typing many keys with D- modifier (#28464)
Problem:  Crash when typing many keys with D- modifier (after 9.1.0227).
Solution: Don't treat a 0x80 byte inside a special sequence as the start
          of a special sequence (zeertzjq).

closes: vim/vim#14613

6b13e3d4e4
2024-04-23 08:18:42 +08:00
Yoshimasa Niwa cb2b5e2780
fix(tui): disable DECRQM and DECRQSS queries for Terminal.app (#28453)
**Problems**

When launching Neovim on Terminal.app on macOS (Apple Terminal),
it briefly shows like
`p$qm+q5463;524742;73657472676266;73657472676262$qm` in orange
background color partially on the screen.

**Solution**

Since Terminal.app seems not supporting DECRQM and DECRQSS queries,
calling `tui_request_term_mode` and `tui_query_extended_underline`
caused this unexpected output.

Therefore, if we know it's Apple Terminal (when `nsterm` is `true`),
don't call these checks.

Tested on Terminal.app (2.14, 453) on macOS 14.4.1.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Gregory Anders <greg@gpanders.com>
2024-04-23 08:17:43 +08:00
Yi Ming 39fc340276
fix(lsp): avoid assertion when `client_hints` do not exist (#28461) 2024-04-22 20:18:49 +02:00
luukvbaal ea1c9f60e0
vim-patch:9.1.0357: Page scrolling should place cursor at window boundaries (#28429)
Problem:  Page scrolling does not always place the cursor at the top or
          bottom of the window (Mathias Rav)
Solution: Place the cursor at the top or bottom of the window.
          (Luuk van Baal)

4b6b0c4024
2024-04-22 21:24:32 +08:00
zeertzjq 783b0aba41
fix(completion): check that healthcheck name is string (#28458) 2024-04-22 19:35:02 +08:00
bfredl f2db5521eb
Merge pull request #28434 from glepnir/23120
fix(float): wrong position when bufpos is out of range
2024-04-22 13:31:41 +02:00
Justin M. Keyes fb5e2db4c7
refactor(api): deprecate nvim_call_atomic #28433
TODO:
FUNC_API_REMOTE_ONLY APIs such as `nvim_ui_*` cannot (yet) be used in
`nvim_exec_lua`. We can change FUNC_API_REMOTE_ONLY to allow
Vimscript/Lua to pass an explicit `channel_id`. #28437
2024-04-22 04:28:16 -07:00
Justin M. Keyes 013afc6863
refactor(lua): deprecate tbl_flatten #28457
forgot some changes in 9912a4c81b
2024-04-22 04:27:57 -07:00
zeertzjq 2cbfa4b9af
fix(window): don't go to unfocusable float when closing (#28455) 2024-04-22 17:57:49 +08:00
Justin M. Keyes 2088521263
Merge #28450 deprecate tbl_flatten 2024-04-21 18:04:21 -07:00
Justin M. Keyes f112ac73bd fix: unreliable "checkhealth completions" test
ref https://github.com/neovim/neovim/issues/19596

    FAILED   test/functional/plugin/health_spec.lua @ 37: :checkhealth completions can be listed via getcompletion()
    test/functional/plugin/health_spec.lua:40: Expected objects to be the same.
    Passed in:
    (string) 'provider.node'
    Expected:
    (string) 'provider.clipboard'

    stack traceback:
            test/functional/plugin/health_spec.lua:40: in function <test/functional/plugin/health_spec.lua:37>
2024-04-22 02:43:24 +02:00
Justin M. Keyes 9912a4c81b refactor(lua): deprecate tbl_flatten
Problem:
Besides being redundant with vim.iter():flatten(), `tbl_flatten` has
these problems:

- Has `tbl_` prefix but only accepts lists.
- Discards some results! Compare the following:
  - iter.flatten():
    ```
    vim.iter({1, { { a = 2 } }, { 3 } }):flatten():totable()
    ```
  - tbl_flatten:
    ```
    vim.tbl_flatten({1, { { a = 2 } }, { 3 } })
    ```

Solution:
Deprecate tbl_flatten.

Note:
iter:flatten() currently fails ("flatten() requires a list-like table")
on this code from gen_lsp.lua:

    local anonym = vim.iter({ -- remove nil
      anonymous_num > 1 and '' or nil,
      '---@class ' .. anonymous_classname,
    }):flatten():totable()

Should we enhance :flatten() to work for arrays?
2024-04-22 02:11:23 +02:00
zeertzjq 35e38833c5
vim-patch:9.1.0363: tests: test_winfixbuf is a bit slow (#28446)
Problem:  tests: test_winfixbuf is a bit slow
Solution: use defer if possible, reset hidden option, use --not-a-term
          when starting Vim using system() (Yegappan Lakshmanan)

closes: vim/vim#14611

4baf908d60

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-04-22 06:24:22 +08:00
Christian Clason 7b8e582f1c vim-patch:d3ff129ce8c6
runtime(astro): Add filetype, syntax and indent plugin

related: vim/vim#14558
closes: vim/vim#14561

ported from: https://github.com/wuelnerdotexe/vim-astro

d3ff129ce8

Co-authored-by: Philip H <47042125+pheiduck@users.noreply.github.com>
2024-04-22 00:18:34 +02:00
Justin M. Keyes f694d020c5
Merge #28440 rename tbl_islist, tbl_isarray 2024-04-21 09:16:16 -07:00
Justin M. Keyes 5c8dfb0e37 refactor(lua): rename tbl_isarray => isarray
tbl_isarray was not released yet, so it will not go through
a deprecation cycle.

ref #24572
2024-04-21 17:42:17 +02:00