Commit Graph

7356 Commits

Author SHA1 Message Date
Christian Clason
a9fd17e232 vim-patch:9.1.0401: filetype: zsh module files are not recognized
Problem:  filetype: zsh module files are not recognized
Solution: Detect '*.mdh' and '*.epro' as C filetype, '*.mdd' as zsh
          filetype, determine zsh-modules '*.pro' from from it's content
          (Wu, Zhenyu)

closes: vim/vim#14737

887a38cee7

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-05-11 09:13:57 +02:00
bfredl
a2c158ad06
Merge pull request #28676 from luukvbaal/tuiflush
fix(tui): initialize clear attrs with current terminal background
2024-05-10 20:01:17 +02:00
Lewis Russell
c1a95d9653 fix(lsp): disable didChangeWatchedFiles on Linux
Problem:

The file watcher backends for Linux have too many limitations and
doesn't work reliably.

Solution:

disable didChangeWatchedFiles on Linux

Ref: #27807, #28058, #23291, #26520
2024-05-10 14:59:44 +01:00
Luuk van Baal
fd50185492 fix(tui): initialize clear attrs with current terminal background
Problem:  Invalidated regions that are flushed during startup are
          cleared with unitialized "clear_attrs", which is perceived as
          flickering.
Solution: Initialize "clear_attrs" with current terminal background color.
2024-05-10 14:13:02 +02:00
Gregory Anders
d3fa88b70f
vim-patch:9.1.0396: filetype: jj files are not recognized (#28672)
Problem:  jj files are not recognized
Solution: recognize '*.jjdescription' files as jj filetype
          (Gregory Anders)

See: https://github.com/martinvonz/jj

closes: vim/vim#14733

6a4ea471d2
2024-05-08 18:39:18 -05:00
zeertzjq
e4e230a0cd
vim-patch:9.1.0397: Wrong display with 'smoothscroll' when changing quickfix list (#28674)
Problem:  Wrong display with 'smoothscroll' when changing quickfix list.
Solution: Reset w_skipcol when replacing quickfix list (zeertzjq).

closes: vim/vim#14730

c7a8eb5ff2
2024-05-09 06:11:56 +08:00
James Trew
93940af1d4 docs(luacats): support backtick captured generic type
Problem:
While LuaCATS's generics system are still considered WIP by luals, they
currently support type captured generics.

See "Capture with Backtick" example:
https://luals.github.io/wiki/annotations/#generic

Solution:
Add support for it in the LuaCATS grammar
2024-05-07 14:33:14 +01:00
zeertzjq
e15991c811
fix(vim.json): properly treat luanil options as booleans (#28622)
Note: Upstream doesn't have this. It's an Nvim addition.
2024-05-03 19:26:56 +08:00
Justin M. Keyes
40ce857797
fix(vim.ui)!: change open() to return result|nil, errmsg|nil #28612
reverts e0d92b9cc2 #28502

Problem:
`vim.ui.open()` has a `pcall()` like signature, under the assumption
that this is the Lua idiom for returning result-or-error. However, the
`result|nil, errmsg|nil` pattern:
- has precedent in:
  - `io.open`
  - `vim.uv` (`:help luv-error-handling`)
- has these advantages:
  - Can be used with `assert()`:
    ```
    local result, err = assert(foobar())
    ```
  - Allows LuaLS to infer the type of `result`:
    ```
    local result, err = foobar()
    if err then
      ...
    elseif result then
      ...
    end
    ```

Solution:
- Revert to the `result|nil, errmsg|nil` pattern.
- Document the pattern in our guidelines.
2024-05-03 03:20:03 -07:00
zeertzjq
d44ed3a885
perf(extmarks): better track whether namespace has extmarks (#28615)
This avoids redraw when adding/removing an empty namespace for a window.

This also avoids marktree traversal when clearing a namespace that has
already been cleared, which is added as a benchmark.
2024-05-03 18:02:25 +08:00
luukvbaal
cf9f002f31
fix(api): use correct buffer for "range" in nvim__redraw (#28614) 2024-05-03 10:35:32 +08:00
Justin M. Keyes
e5c69df679
Merge #28101 nvim__redraw 2024-05-02 07:49:07 -07:00
Yi Ming
350d818564
feat(lsp): inlay_hint.is_enabled({filter}) #28523
vim.diagnostic.enable and vim.diagnostic.is_enabled() use the same pattern.
2024-05-02 07:26:07 -07:00
Luuk van Baal
037ea6e786 feat(api): add nvim__redraw for more granular redrawing
Experimental and subject to future changes.
Add a way to redraw certain elements that are not redrawn while Nvim is waiting
for input, or currently have no API to do so. This API covers all that can be
done with the :redraw* commands, in addition to the following new features:
- Immediately move the cursor to a (non-current) window.
- Target a specific window or buffer to mark for redraw.
- Mark a buffer range for redraw (replaces nvim__buf_redraw_range()).
- Redraw the 'statuscolumn'.
2024-05-02 15:57:06 +02:00
Yi Ming
d5063f4b29
feat(lsp): vim.lsp.inlay_hint.enable(nil) applies to all buffers #28543
Problem:
Inlay hints `enable()` does not fully implement the `:help dev-lua` guidelines:

    Interface conventions ~
    - When accepting a buffer id, etc., 0 means "current buffer", nil means "all
      buffers".  Likewise for window id, tabpage id, etc.
      - Examples: |vim.lsp.codelens.clear()| |vim.diagnostic.enable()|

Solution:
Implement globally enabling inlay hints.
* refactor(lsp): do not rely on `enable` to create autocmds
* refactor(lsp): make `bufstates` a defaulttable
* refactor(lsp): make `bufstate` inherit values from `globalstate`
* feat(lsp): `vim.lsp.inlay_hints` now take effect on all buffers by default
* test(lsp): add basic tests for enable inlay hints for all buffers
* test(lsp): add test cases cover more than one buffer
2024-05-02 06:16:20 -07:00
Christian Clason
2becec289c vim-patch:9.1.0390: filetype: inko files are not recognized
Problem:  filetype: inko files are not recognized
Solution: Detect '*.inko' as ink filetype
          (Yorick Peterse)

See:
- https://github.com/inko-lang/inko.vim
- https://inko-lang.org/

closes: vim/vim#14699

a01968448a

Co-authored-by: Yorick Peterse <git@yorickpeterse.com>
2024-05-02 14:14:56 +02:00
Christian Clason
ebf8237af8 vim-patch:9.1.0389: filetype: templ files are not recognized
Problem:  filetype: templ files are not recognized
Solution: Detect '*.templ' files as filetype templ
          (Tristan Knight)

See:
- https://github.com/a-h/templ
- https://templ.guide/

closes: vim/vim#14697

54e79157c5

Co-authored-by: tris203 <admin@snappeh.com>
2024-05-02 14:14:56 +02:00
zeertzjq
c4627676f9
vim-patch:9.1.0388: cursor() and getregion() don't handle v:maxcol well (#28602)
Problem:  cursor() and getregion() don't handle v:maxcol well.
Solution: Add special handling for v:maxcol like setpos() does.
          (zeertzjq)

closes: vim/vim#14698

2ffdae7948
2024-05-02 19:33:54 +08:00
Christian Clason
9e2f378b6d vim-patch:9.1.0386: filetype: stylus files not recognized
Problem:  filetype: stylus files not recognized
Solution: Detect '*.styl' and '*.stylus' as stylus filetype,
          include indent, filetype and syntax plugin
          (Philip H)

closes: vim/vim#14656

2d919d2744

Co-authored-by: Philip H <47042125+pheiduck@users.noreply.github.com>
2024-05-02 00:37:16 +02:00
luukvbaal
e778e01161
fix(ui): avoid recursiveness and invalid memory access #28578
Problem:  Calling :redraw from vim.ui_attach() callback results in
          recursive cmdline/message events.
Solution: Avoid recursiveness where possible and replace global "call_buf"
          with separate, temporary buffers for each event so that when a Lua
          callback for one event fires another event, that does not result
          in invalid memory access.
2024-05-01 13:51:06 -07:00
Gregory Anders
0b8a72b739
revert: "feat(extmarks): subpriorities (relative to declaration order) (#27131)" (#28585)
This reverts commit 15e77a56b7.

Subpriorities were added in https://github.com/neovim/neovim/pull/27131
as a mechanism for enforcing query order when using iter_matches in the
Tree-sitter highlighter. However, iter_matches proved to have too many
complications to use in the highlighter so we eventually reverted back
to using iter_captures (https://github.com/neovim/neovim/pull/27901).
Thus, subpriorities are no longer needed and can be removed.
2024-05-01 08:08:22 -05:00
Christian Clason
b5583acc48 vim-patch:9.1.0383: filetype: .out files recognized as tex files
Problem:  filetype: .out files recognized as tex files
Solution: Do not set an explicit filetype until it is clear what this
          should be (shane.xb.qian)

closes: vim/vim#14670

e35478bc9d

Co-authored-by: shane.xb.qian <shane.qian@foxmail.com>
2024-05-01 10:34:03 +02:00
Christian Clason
e7ae913953 vim-patch:9.1.0382: filetype: Kbuild files are not recognized
Problem:  Kbuild files are not recognized.
Solution: Detect Kbuild files as make files.
          (Bruno Belanyi)

closes: vim/vim#14676

5cbc9a69e5

Co-authored-by: Bruno BELANYI <bruno@belanyi.fr>
2024-05-01 10:34:03 +02:00
Lewis Russell
ee41153a94 feat(diagnostic): revert default behaviour of goto_next/prev()
Follow-up to #28490

Problem:

The new behaviour of goto_next/prev() of navigating to the next highest
severity doesn't work well when diagnostic providers have different
interpretations of severities. E.g. the user may be blocked from
navigating to a useful LSP warning, due to some linter error.

Solution:

The behaviour of next highest severity is now a hidden option
`_highest = true`. We can revisit how to integrate this behaviour
during the 0.11 cycle.
2024-04-30 13:39:27 +01:00
Justin M. Keyes
0330dd9e69
fix(api): mark nvim__complete_set as experimental #28579
Problem:
nvim_complete_set was added in 5ed55ff14c
but needs more bake time.

Solution:
Rename it, mark it as experimental.
2024-04-30 05:12:51 -07:00
zeertzjq
efaf37a2b9
test(old): restore default 'grepprg' and 'grepformat' (#28574)
This prevents test failure when "rg" is executable.
2024-04-30 07:44:25 +08:00
dundargoc
234b5f6701
docs: various fixes (#28208)
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Co-authored-by: Famiu Haque <famiuhaque@proton.me>
Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: Guilherme Soares <guilhermesoares1970@gmail.com>
Co-authored-by: Jannik Buhr <jannik.m.buhr@gmail.com>
Co-authored-by: thomaswuhoileong <72001875+thomaswuhoileong@users.noreply.github.com>
Co-authored-by: tom-anders <13141438+tom-anders@users.noreply.github.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-04-30 07:04:42 +08:00
zeertzjq
f59db07cdc
vim-patch:9.1.0381: cbuffer and similar commands don't accept a range (#28571)
Problem:  cbuffer and similar quickfix and locationlist commands don't
          accept a range, even so it is documented they should
          (ilan-schemoul, after 8.1.1241)
Solution: Define ex commands with ADDR_LINES instead of ADDR_OTHER

fixes: vim/vim#14638
closes: vim/vim#14657

652c821366

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-04-30 06:02:38 +08:00
Maria José Solano
bc7f86209d
fix(lsp): redundant vim.snippet.jumpable #28560 2024-04-29 13:45:53 -07:00
bfredl
0df681a91d fix(treesitter): make tests for memoize more robust
Instead of painfully messing with timing to determine if queries were
reparsed, we can simply keep a counter next to the call to ts_query_new

Also memoization had a hidden dependency on the garbage collection of
the the key, a hash value which never is kept around in memory. this was
done intentionally as the hash does not capture all relevant state for the
query (external included files) even if actual query objects still
would be reachable in memory. To make the test fully deterministic in
CI, we explicitly control GC.
2024-04-29 16:20:46 +02:00
luukvbaal
ab1c2220f0
fix(ui): activating all ext capabilities without remote UI #28555 2024-04-28 17:51:33 -07:00
Christian Clason
26b5405d18
fix(treesitter): enforce lowercase language names (#28546)
* fix(treesitter): enforce lowercase language names

Problem: On case-insensitive file systems (e.g., macOS), `has_parser`
will return `true` for uppercase aliases, which will then try to inject
the uppercase language unsuccessfully.

Solution: Enforce and assume parser names to be lowercase when
resolving language names.
2024-04-28 16:27:47 +02:00
Mathias Fußenegger
4625394a76
fix(snippet): do not add extra indent on newlines (#28538)
Reverts parts of https://github.com/neovim/neovim/pull/27674

LSP snippets typically do include tabs or spaces to add extra
indentation and don't rely on the client using `autoindent`
functionality.

For example:

    public static void main(String[] args) {\n\t${0}\n}

Notice the `\t` after `{\n`

Adding spaces or tabs independent of that breaks snippets for languages
like Haskell where you can have snippets like:

    ${1:name} :: ${2}\n${1:name} ${3}= ${0:undefined}

To generate:

    name ::
    name = undefined
2024-04-28 12:49:25 +02:00
Raphael
96f59e1b99
fix(diagnostic): invalid col number compare in next_diagnostic (#28397)
Problem: when line is blank link then there will got an invalid column number in math.min compare.

Solution: make sure the min column number is 0 not an illegal number.
2024-04-27 16:05:41 -05:00
Justin M. Keyes
158e329725
Merge #28522 handle ui_attach side effects 2024-04-27 06:37:40 -07:00
zeertzjq
41ceadd458
vim-patch:9.1.0375: tests: 1-second delay after Test_BufEnter_botline() (#28534)
Problem:  tests: 1-second delay after Test_BufEnter_botline()
          (after v9.1.0374)
Solution: Wipe the created buffers (zeertzjq).

closes: vim/vim#14647

340643e977
2024-04-27 18:02:18 +08:00
Luuk van Baal
b8c1b36061 fix(ui): set 'cmdheight' to zero for all open tabpages
Problem:  Enabling ext_messages claims to set 'cmdheight' to zero, but
only does so for the current tabpage.
Solution: Set stored 'cmdheight' value to zero for all tabpages.
2024-04-27 01:00:55 +02:00
zeertzjq
435dee74bb
vim-patch:9.1.0374: wrong botline in BufEnter (#28530)
Problem:  When :edit an existing buffer, line('w$') may return a
          wrong result.
Solution: Reset w_valid in curwin_init() (Jaehwang Jung)

`do_ecmd()` reinitializes the current window (`curwin_init()`) whose
`w_valid` field may have `VALID_BOTLINE` set. Resetting `w_botline`
without marking it as invalid makes subsequent `validate_botline()`
calls a no-op, thus resulting in wrong `line('w$')` value.

closes: vim/vim#14642

eb80b8304e

Co-authored-by: Jaehwang Jung <tomtomjhj@gmail.com>
2024-04-27 06:32:25 +08: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
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
Luuk van Baal
7626f431d8 fix(ui): update ext_ui widgets when attaching non-remote UI
Problem:  Updating internalized UI capabilities is postponed until a
          remote UI attaches.
Solution: Always update active UI widgets in ui_refresh().
2024-04-26 16:42:08 +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
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
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
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