Commit Graph

6552 Commits

Author SHA1 Message Date
Lewis Russell
59cf827f99 refactor(lsp): move client code to a regular Lua class
Problem:
  The LSP client code is implemented as a complicated closure-class
  (class defined in a single function).

Solution:
  Move LSP client code to a more conventional Lua class and move to a
  separate file.
2024-02-07 19:48:37 +00:00
altermo
c0b99bb1de
feat(treesitter): show root nodes in :InspectTree (#26944)
Co-authored-by: altermo <>
Co-authored-by: Jongwook Choi <wookayin@gmail.com>
2024-02-06 14:51:53 -06:00
Lewis Russell
c4417ae70c fix(doc): prevent doxygen confusion 2024-02-06 15:29:01 +00:00
Lewis Russell
3be2536ca0 fix(lsp): send back diagnostic tags to the server
Fixes: #27318
2024-02-06 12:35:31 +00:00
dundargoc
63b810c9d8
docs: small fixes (#27213)
Co-authored-by: Matthieu Coudron <886074+teto@users.noreply.github.com>
2024-02-06 19:30:02 +08:00
Christian Clason
9a761019da vim-patch:f7f33e3719c8
runtime(dosbatch): improve '::' comment highlighting

Added a syntax region for command blocks so that the highlighting of
`::` comments in them can be controlled.  The `dosbatch_colons_comment`
variable now controls if all `::` comments in a code block are
highlighted as comments or errors.  A `::` comment at the end of a
command block is always highlighted as an error.

This re-enables the highlighting of `::` comments in `.bat` files as
requested in vim/vim#13666, while allowing control of highlighting them in
command blocks requested in vim/vim#11778 and first attempted in vim/vim#11980.

related: vim/vim#11980
fixes: vim/vim#13666

f7f33e3719

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Mike Williams <mikew@globalgraphics.com>
2024-02-06 11:42:15 +01:00
Jongwook Choi
a478bf936b feat(treesitter): use 0-based indexing to show ranges in :InspectTree
Problem:

- `:InspectTree` was showing node ranges in 1-based indexing, i.e., in
  vim cursor position (lnum, col). However, treesitter API adopts
  0-based indexing to represent ranges (Range4). This can often be
  confusing for developers and plugin authors when debugging code
  written with treesiter APIs.

Solution:

- Change to 0-based indexing from 1-based indexing to show node ranges
  in `:InspectTree`.

- Note: To make things not complicated, we do not provide an option or
  keymap to configure which indexing mode to use.
2024-02-05 16:23:22 -05:00
Maria José Solano
0e9a33572d fix(lsp): handle adjacent snippet tabstops 2024-02-05 15:03:46 +00:00
Lewis Russell
43661a0abf
Merge pull request #27328 from wookayin/fix/lsp-tagfunc 2024-02-05 10:35:25 +00:00
altermo
6c8387067d fix(treesitter): inspect-tree remember opts on buf change 2024-02-04 15:53:29 +00:00
Christian Clason
1d5f86f694 vim-patch:9.1.0076: luau config file not detected
Problem:  luau config file not detected
          (lopy)
Solution: Detect it as jsonc
          (lopy)

fixes: vim/vim#13960
closes: vim/vim#13970

de7f5bde6c

Co-authored-by: lopy <70210066+lopi-py@users.noreply.github.com>
2024-02-04 11:14:40 +01:00
zeertzjq
cd3399f6bd
vim-patch:7c5aeaffa2be (#27327)
runtime(vim): Update syntax file (vim/vim#13969)

Improve string interpolation highlighting.

Use the vimSep group to highlight interpolation braces as vimOperParen
has no highlighting of its own and employs vimSep via matchgroup.

Add vimNumber to the interpolation group's contained list.

7c5aeaffa2

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-04 07:09:54 +08:00
Jongwook Choi
f487e5af01 fix(lsp): fix infinite loop on vim.lsp.tagfunc
Problem: vim.lsp.tagfunc() causes an infinite loop.

This is a bug happened while introducing deferred loading.

Solution: Rename the private module to `vim.lsp._tagfunc`.
2024-02-03 17:47:56 -05:00
dundargoc
2e982f1aad refactor: create function for deferred loading
The benefit of this is that users only pay for what they use. If e.g.
only `vim.lsp.buf_get_clients()` is called then they don't need to load
all modules under `vim.lsp` which could lead to significant startuptime
saving.

Also `vim.lsp.module` is a bit nicer to user compared to
`require("vim.lsp.module")`.

This isn't used for some nested modules such as `filetype` as it breaks
tests with error messages such as "attempt to index field 'detect'".
It's not entirely certain the reason for this, but it is likely it is
due to filetype being precompiled which would imply deferred loading
isn't needed for performance reasons.
2024-02-03 16:53:41 +01:00
zeertzjq
9b7cf4f0be
fix(vim.system): don't process non-fast events during wait() (#27300)
Problem:
Processing non-fast events during SystemObj:wait() may cause two pieces
of code to interfere with each other, and is different from jobwait().

Solution:
Don't process non-fast events during SystemObj:wait().
2024-02-02 21:52:01 +08:00
zeertzjq
e98decf9a6
feat(quickfix): support -q - to read 'errorfile' from stdin (#27303)
Note that this only works when stdin is a pipe.
2024-02-02 21:17:37 +08:00
Christian Clason
1bf645918e vim-patch:9204f39580bd
runtime(fortran): update syntax (vim/vim#13953)

* runtime (Fortran) update syntax
* runtime (Fortran) small fix

9204f39580

Co-authored-by: Ajit-Thakkar <142174202+Ajit-Thakkar@users.noreply.github.com>
2024-02-02 08:59:49 +01:00
zeertzjq
1405e5c8c1
refactor(runtime): remove nvimMap and nvimUnmap syntax groups (#27298)
They are no longer needed as they are covered by vimMap and vimUnmap.
Also fix some other mistakes and missing changes.
2024-02-02 10:45:15 +08:00
zeertzjq
11acbd6df4 vim-patch:e3e3934bb182
runtime(vim): Update syntax file (vim/vim#13948)

Improve string escape sequence and special key matching.

e3e3934bb1

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-02 06:46:11 +08:00
zeertzjq
882d5fa558 vim-patch:69866449ddb2
runtime(vim): Improve keymap file highlighting (vim/vim#13550)

- Match :loadkeymap to EOF as a region and contain only allowed items.
- Add highlighting for <Char- notation.
- add basic syntax highlighting tests

69866449dd

N/A patches:
vim-patch:35928ee8f80ea721e92bb856c8ecde2cced46bb9
vim-patch:b5352931b354eb67eb7d223cc09c98dcf1b547b6

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-02 06:45:06 +08:00
dundargoc
4c91194611 build: various fixes
- Consistently use the variable CMAKE_BUILD_TYPE to select build type.
- Remove broken `doc_html` target.
- Remove swap files created by oldtest when cleaning.
- Only rerun `lintdoc` if any documentation files has changed.
2024-02-01 12:06:55 +01:00
Christian Clason
0da18ae5ce vim-patch:c46c21b4ca47
runtime(netrw): fixing remote file removal via ssh (vim/vim#13942)

Make pattern, which retrieves the path component from e.g.
`scp://user@host//opt/program/file.ext` non-greedy.

c46c21b4ca

Co-authored-by: MiguelBarro <45819833+MiguelBarro@users.noreply.github.com>
2024-02-01 10:04:32 +01:00
Christian Clason
e0961aaa5a vim-patch:83f627ff42a3
runtime(racket): add missing space to b:undo_indent var (vim/vim#13945)

This copies commit 2a4862a (fixup! indent: only reset some options when
has vim9, 2024-01-31) from https://github.com/benknoble/vim-racket and
fixes 26b0176a9 (runtime(racket): undo some indent options only when
vim9script is available (vim/vim#13935), 2024-01-30).

83f627ff42

Co-authored-by: D. Ben Knoble <ben.knoble+github@gmail.com>
2024-02-01 10:04:32 +01:00
Will Hopkins
6bba4beced
feat(api): make nvim_open_win support non-floating windows (#25550)
Adds support to `nvim_open_win` and `nvim_win_set_config` for creating
and manipulating split (non-floating) windows.
2024-02-01 11:43:35 +08:00
Christian Clason
f4b3636f24 vim-patch:bdb9d9afba97
runtime(netrw): Use :exec norm! <leftmouse> before :call mapping in netrw (vim/vim#12180)

fixes: vim/vim#12143

bdb9d9afba

Co-authored-by: user202729 <25191436+user202729@users.noreply.github.com>
2024-01-31 09:55:08 +01:00
Christian Clason
6e8e3a2a3a vim-patch:26b0176a98f8
runtime(racket): undo some indent options only when vim9script is available (vim/vim#13935)

This copies commit 64edf95 (indent: only reset some options when has
vim9, 2024-01-30) from https://github.com/benknoble/vim-racket.

26b0176a98

Co-authored-by: D. Ben Knoble <ben.knoble+github@gmail.com>
2024-01-31 09:55:08 +01:00
Justin M. Keyes
a060c13f55
Merge #27246 from justinmk/health 2024-01-29 09:43:49 -08:00
Evgeni Chasnovski
4f788f78f8
vim-patch:9.1.0061: UX of visual highlighting can be improved (#27256)
Problem:  UX of visual highlighting can be improved
Solution: Improve readibility of visual highlighting,
          by setting better foreground and background
          colors

The default visual highlighting currently is nice in that it overlays
the actual syntax highlighting by using a separate distinct background
color.

However, this can cause hard to read text, because the contrast
between the actual syntax element and the background color is way too
low. That is an issue, that has been bothering colorschemes authors for
quite some time so much, that they are defining the Visual highlighting
group to use a separate foreground and background color, so that the
syntax highlighting vanishes, but the text remains readable (ref:
vim/colorschemesvim/vim#250)

So this is an attempt to perform the same fix for the default Visual
highlighting and just use a default foreground and background color
instead of using reverse.

I also removed the hard-coded changes to the Visual highlighting in
init_highlight. It's not quite clear to me, why those were there and not
added directly to the highlighting_init_<dark|light> struct.

closes: vim/vim#13663
related: vim/colorschemes#250

e6d8b4662d

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-01-29 18:39:57 +08:00
Will Hopkins
ca9f6f5694
feat(api): add nvim_tabpage_set_win (#27222)
Allows setting the current window of a non-current tabpage
without switching tabpages.
2024-01-29 15:18:33 +08:00
zeertzjq
5e5b004da4 vim-patch:cf8695d48cdd
runtime(vim): Highlight string interpolation

closes: vim/vim#13923

cf8695d48c

Co-authored-by: thinca <thinca@gmail.com>
2024-01-29 11:25:35 +08:00
zeertzjq
7db83d47b2 vim-patch:21ce159e0561
runtime(vim): Update syntax and ftplugin files (vim/vim#13924)

Improve matching of line-continuations and interspersed comments.

These are now also matched in multiline syntax command patterns,
dictionary literals, and parenthesised expressions and argument lists.

21ce159e05

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-01-29 11:25:35 +08:00
zeertzjq
d62b3fa623 vim-patch:c79646dfb101
runtime(vim): Update syntax file (vim/vim#13671)

Support multiline :syntax commands.

Match :syn-cchar option in :syn-{keyword,region}.

c79646dfb1

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-01-29 11:25:35 +08:00
zeertzjq
f1e51528d2 vim-patch:71b6d3397649
Update runtime files

71b6d33976

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-01-29 11:25:35 +08:00
Gregory Anders
15e77a56b7
feat(extmarks): subpriorities (relative to declaration order) (#27131)
The "priority" field of extmarks can be used to set priorities of
extmarks which dictates which highlight group a range will actually have
when there are multiple extmarks applied. However, when multiple
extmarks have the same priority, the only way to enforce an actual
priority is through the order in which the extmarks are set.

It is not always possible or desirable to set extmarks in a specific
order, however, so we add a new "subpriority" field that explicitly
enforces the ordering of extmarks that have the same priority.

For now this will be used only to enforce priority of treesitter
highlights. A single node in a treesitter tree may match multiple
captures, in which case that node will have multiple extmarks set. The
order in which captures are returned from the treesitter API is not
_necessarily_ in the same order they are defined in a query file, so we
use the new subpriority field to force that ordering.

For now subpriorites are not documented and are not meant to be used by
external code, and it only applies to ephemeral extmarks. We indicate
the "private" nature of subpriorities by prefixing the field name with
an "_".
2024-01-28 21:13:58 -06:00
Maria José Solano
eee52d3427
refactor(lsp): client_hints typo #27250 2024-01-28 18:38:36 -08:00
Jongwook Choi
5b1b765610
docs: enforce "treesitter" spelling #27110
It's the "tree-sitter" project, but "treesitter" in our code and docs.
2024-01-28 17:53:14 -08:00
Justin M. Keyes
e39b6d0c52 fix(health): "attempt to concatenate nil"
Problem:
If `neovim` module is not installed, python and ruby healthchecks fail:

    - ERROR Failed to run healthcheck for "provider.python" plugin. Exception:
      .../runtime/lua/provider/python/health.lua:348: attempt to concatenate local 'pyname' (a nil value)
    - ERROR Failed to run healthcheck for "provider.ruby" plugin. Exception:
      .../runtime/lua/provider/ruby/health.lua:25: attempt to index local 'host' (a nil value)

Solution:
Check for non-nil.
2024-01-28 23:56:06 +01:00
Justin M. Keyes
50cd5ed360 fix(health): check more "old" files 2024-01-28 23:56:03 +01:00
Sean Dewar
d85f180f26
vim-patch:9.1.0049: Make "[Command Line]" a special buffer name
Problem:  E95 is possible if a buffer called "[Command Line]" already
          exists when opening the cmdwin. This can also happen if the
          cmdwin's buffer could not be deleted when closing.

Solution: Un-name the cmdwin buffer, and give it a special name instead,
          similar to what's done for quickfix buffers and for unnamed
          prompt and scratch buffers. As a result, BufFilePre/Post are
          no longer fired when opening the cmdwin. Add a "command" key
          to the dictionary returned by getbufinfo() to differentiate
          the cmdwin buffer instead. (Sean Dewar)

Cherry-pick test_normal changes from v9.0.0954.

1fb4103206
2024-01-28 12:29:42 +00:00
Justin M. Keyes
2cd76a758b
docs(lua): update ":{range}lua" docs + error message #27231
- `:lua (no file)` is misleading because `:lua` never takes a file arg,
  unlike `:source`.
- Update various related docs.
2024-01-27 10:40:30 -08:00
Christian Clason
17b298b7c8 vim-patch:0cc6108fea21
runtime(ant): Update syntax file (vim/vim#13926)

Remove invalid display option from syn-keyword commands.

Take over maintenance of this file.

0cc6108fea

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-01-27 19:38:05 +01:00
Christian Clason
e35ae6fbc2 vim-patch:772f8f542513
runtime(hurl): add hurl filetype plugin(vim/vim#13921)

772f8f5425

Co-authored-by: Melker Ulander <melker.ulander@pm.me>
2024-01-27 12:02:59 +01:00
luukvbaal
c2433589dc
feat(ex_cmds): ranged :lua #27167
:{range}lua executes the specified lines in the current buffer as
Lua code, regardless of its extension or 'filetype'.

Close #27103
2024-01-26 17:00:50 -08:00
Till Bungert
0892c080d1
revert: "feat(treesitter): add foldtext with treesitter highlighting"
This reverts commit 9ce1623 in favor of #20750.
2024-01-27 08:38:56 +08:00
Evgeni Chasnovski
a9df0c5ce6
fix(osc52): do not use 'vim.iter' (#27218)
Problem: Using 'vim.iter' loads it during startup.

Solution: Do not use 'vim.iter'.
2024-01-26 12:06:13 -06:00
Lewis Russell
28d1640dd6 feat: improve return type annotations for vim.api.* 2024-01-26 15:07:25 +00:00
Christian Clason
b7e3003106 vim-patch:046a0f75d025
runtime(mail): fix vim/vim#13913 (vim/vim#13917)

switch to the DFA engine for the emoji collaction range

046a0f75d0

Co-authored-by: gi1242 <gi1242+github@gmail.com>
Co-authored-by: GI <gi1242+vim@gmail.com>
2024-01-26 08:51:13 +01:00
zeertzjq
226466a469
vim-patch:9.1.0058: Cannot map Super Keys in GTK UI (#27204)
Problem:  Cannot map Super Keys in GTK UI
          (Casey Tucker)
Solution: Enable Super Key mappings in GTK using <D-Key>
          (Casey Tucker)

As a developer who works in both Mac and Linux using the same keyboard,
it can be frustrating having to remember different key combinations or
having to rely on system utilities to remap keys.

This change allows `<D-z>` `<D-x>` `<D-c>` `<D-v>` etc. to be recognized
by the `map` commands, along with the `<D-S-...>` shifted variants.

```vimrc
if has('gui_gtk')
	nnoremap  <D-z>    u
	nnoremap  <D-S-Z>  <C-r>
	vnoremap  <D-x>    "+d
	vnoremap  <D-c>    "+y
	cnoremap  <D-v>    <C-R>+
	inoremap  <D-v>    <C-o>"+gP
	nnoremap  <D-v>    "+P
	vnoremap  <D-v>    "-d"+P
	nnoremap  <D-s>    :w<CR>
	inoremap  <D-s>    <C-o>:w<CR>
	nnoremap  <D-w>    :q<CR>
	nnoremap  <D-q>    :qa<CR>
	nnoremap  <D-t>    :tabe<CR>
	nnoremap  <D-S-T>  :vs#<CR><C-w>T
	nnoremap  <D-a>    ggVG
	vnoremap  <D-a>    <ESC>ggVG
	inoremap  <D-a>    <ESC>ggVG
	nnoremap  <D-f>    /
	nnoremap  <D-g>    n
	nnoremap  <D-S-G>  N
	vnoremap  <D-x>    "+x
endif
```

closes: vim/vim#12698

92e90a1e10

Co-authored-by: Casey Tucker <dctucker@hotmail.com>
2024-01-26 11:04:54 +08:00
Evgeni Chasnovski
1e0996b572 feat(colorscheme): update treesitter groups
Problem: Currently default color scheme defines most of treesitter
  highlight groups. This might be an issue for users defining their own
  color scheme as it breaks the "fallback property" for some of groups.

Solution: Define less default treesitter groups; just enough for default
  color scheme to be useful. That is:
    - All first level groups (`@character`, `@string`, etc.).
    - All `@xxx.builtin` groups as a most common subgroup.
    - Some special cases (links/URLs, `@diff.xxx`, etc.).
2024-01-25 20:09:24 +01:00
Evgeni Chasnovski
3ab6f60dc8 fix(runtime): update 'vim' color scheme to use new tree-sitter groups 2024-01-25 18:19:15 +01:00