Commit Graph

29443 Commits

Author SHA1 Message Date
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
Justin M. Keyes
d9d890562e refactor(lua): rename tbl_islist => islist
ref #24572
2024-04-21 17:08:07 +02:00
Lewis Russell
032df963bb refactor(treesitter): language loading 2024-04-21 14:09:27 +01:00
zeertzjq
6d732ad3c9
refactor: add function attributes to xmemcpyz() (#28435)
Also attempt to fix the new coverity warning.
2024-04-21 16:44:40 +08:00
Jaehwang Jung
2b6c9bbe7f perf(treesitter): incremental foldupdate
Problem:
While the fold level computation is incremental, the evaluation of the
foldexpr is done on the full buffer. Despite that the foldexpr reads
from the cache, it can take tens of milliseconds for moderately big (10K
lines) buffers.

Solution:
Track the range of lines on which the foldexpr should be evaluated.
2024-04-21 10:42:00 +02:00
bfredl
f42ab1dc48
Merge pull request #27872 from luukvbaal/cmdheight
fix(ui): don't force 'cmdheight' to zero with ext_messages
2024-04-21 09:31:24 +02:00
glepnir
5f18dd3013 fix(float): wrong position when bufpos is set
Problem: when lnum in bufpos is out of range the position of float is wired.

Solution: avoid the height value out of buffer line range.
2024-04-21 15:25:46 +08:00
luukvbaal
344906a08f
fix(api): do not update grid position in nvim_win_set_cursor (#28235)
Revert commit c971f538ab.
Forcing grid cursor position will need a new API like originally proposed in #27858.
2024-04-21 08:15:18 +08:00
Christian Clason
9e1bbb9813 vim-patch:564166f68184
ftplugin(cmake): Add include and suffixesadd

closes: vim/vim#14520

564166f681

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-04-21 00:09:48 +02:00
Riley Bruins
5e6240ffc2 feat(treesitter): handle quantified fold captures 2024-04-20 22:11:45 +02:00
Justin M. Keyes
8886b1807c
refactor(lua): "module" => "M" #28426
Most of the codebase uses the `M` convention for Lua module.
Update the last remaining cases.
2024-04-20 09:06:49 -07:00
Luuk van Baal
b5a38530ba fix(ui): don't force 'cmdheight' to zero with ext_messages
Remove remaining code that prevents non-zero 'cmdheight' with ext_messages.
2024-04-20 15:44:12 +02:00
Yinzuo Jiang
f190f758ac
feat(lsp): add vim.lsp.buf.subtypes(), vim.lsp.buf.supertypes() (#28388)
Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
Co-authored-by: Maria José Solano <majosolano99@gmail.com>
2024-04-20 15:40:01 +02:00
Justin M. Keyes
fd085d9082
fix(vim.ui.open): try wslview before explorer.exe #28424
Problem:
explorer.exe is unreliable on WSL.

Solution:
Try wslview before explorer.exe.

fix #28410
2024-04-20 05:47:08 -07:00
zeertzjq
0ea38c9a53
refactor: add xmemcpyz() and use it in place of some xstrlcpy() (#28422)
Problem:  Using xstrlcpy() when the exact length of the string to be
          copied is known is not ideal because it requires adding 1 to
          the length and an unnecessary strlen().
Solution: Add xmemcpyz() and use it in place of such xstrlcpy() calls.
2024-04-20 19:31:00 +08:00
zeertzjq
4d52b0cf67
fix(showcmd): clear the rest properly (#28420) 2024-04-20 08:12:45 +08:00
Christian Clason
52d2851ca4 vim-patch:9.1.0355: filetype: flake.lock files are not recognized
Problem:  filetype: flake.lock files are not recognized
Solution: Detect 'flake.lock' as json filetype
          (Riley Bruins)

closes: vim/vim#14589

ce736033ae

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2024-04-19 16:09:41 +02:00
Christian Clason
57c8f68e3b vim-patch:cee034112d41
runtime(bp): fix comment definition in filetype plugin (vim/vim#14594)

I somehow messed up the previous patch, I think a copy-paste error when
creating the file.

Blueprint files have C and C++ style comments, not shell-like '#'
comments.

cee034112d

Co-authored-by: Bruno BELANYI <bruno@belanyi.fr>
2024-04-19 16:09:30 +02:00
Justin M. Keyes
18da6964cc
refactor(vim.iter)!: remove vim.iter.map/filter/totable #26138
Problem:
The use-case for the convenience functions vim.iter.map(),
vim.iter.filter(), vim.iter.totable() is not clear.

Solution:
Drop them for now. We can revisit after 0.10 release.
2024-04-19 06:22:41 -07:00
Christian Clason
9319d97679 build(deps): bump luajit to HEAD - 75e927779 2024-04-19 09:11:51 +02:00
zeertzjq
8d77061051
vim-patch:9.1.0354: runtime(uci): No support for uci file types (#28409)
Problem:  runtime(uci): No support for uci file types
          (Wu, Zhenyu)
Solution: include basic uci ftplugin and syntax plugins
          (Colin Caine)

closes: vim/vim#14575

4b3fab14db

Co-authored-by: Colin Caine <complaints@cmcaine.co.uk>
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-04-19 14:50:12 +08:00
zeertzjq
3e6a9fb599
vim-patch:36e667ab837c (#28407)
runtime(java): Support "g:ftplugin_java_source_path" with archived files

Also, document for "g:ftplugin_java_source_path" its current
modification of the local value of the 'path' option.

closes: vim/vim#14570

36e667ab83

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2024-04-19 14:49:33 +08:00
zeertzjq
13ebfafc95
vim-patch:9.1.0351: No test that completing a partial mapping clears 'showcmd' (#28406)
Problem:  No test that completing a partial mapping clears 'showcmd'.
Solution: Complete partial mappings in Test_showcmd_part_map() instead
          of using :echo.  Adjust some comments (zeertzjq).

closes: vim/vim#14580

094c4390bd
2024-04-19 05:45:25 +08:00
dundargoc
c791aa8aae docs: update supported platforms 2024-04-18 23:39:26 +02:00
Maria José Solano
97c0a52416
fix(lsp): correct deprecation message #28403 2024-04-18 12:06:52 -07:00
Justin M. Keyes
f1dfe32bf5
feat(lua): enable(enable:boolean, filter:table) #28374
Problem:
We need to establish a pattern for `enable()`.

Solution:
- First `enable()` parameter is always `enable:boolean`.
- Update `vim.diagnostic.enable()`
- Update `vim.lsp.inlay_hint.enable()`.
    - It was not released yet, so no deprecation is needed. But to help
      HEAD users, it will show an informative error.
- vim.deprecate():
    - Improve message when the "removal version" is a *current or older* version.
2024-04-18 07:57:58 -07:00
Mathias Fußenegger
97323d821b
refactor(lsp): merge rpc.domain_socket_connect into rpc.connect (#28398)
See discussion in https://github.com/neovim/neovim/pull/26850
2024-04-18 15:34:10 +02:00
Riley Bruins
206475d791
build(nix): update flake to prevent build errors #28394
- Updates nixpkgs to source a necessary Tree-sitter version
- Updates to a new llvm version as the old one was removed from nixpkgs
- Properly moves `doCheck` from a regular param to an attribute option
2024-04-18 04:48:07 -07:00