Commit Graph

6608 Commits

Author SHA1 Message Date
Tim Pope
4541189052 fix(lsp): support workspace/configuation with no section 2024-02-17 17:53:49 -05:00
Gregory Anders
478273a423
fix: fix iter_matches call in query linter (#27496) 2024-02-16 14:00:19 -06:00
Thomas Vigouroux
bd5008de07
fix(treesitter): correctly handle query quantifiers (#24738)
Query patterns can contain quantifiers (e.g. (foo)+ @bar), so a single
capture can map to multiple nodes. The iter_matches API can not handle
this situation because the match table incorrectly maps capture indices
to a single node instead of to an array of nodes.

The match table should be updated to map capture indices to an array of
nodes. However, this is a massively breaking change, so must be done
with a proper deprecation period.

`iter_matches`, `add_predicate` and `add_directive` must opt-in to the
correct behavior for backward compatibility. This is done with a new
"all" option. This option will become the default and removed after the
0.10 release.

Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Co-authored-by: MDeiml <matthias@deiml.net>
Co-authored-by: Gregory Anders <greg@gpanders.com>
2024-02-16 11:54:47 -06:00
Marcus Michaels
1ba3500abd
docs(tutor): include https urls where applicable (#27461)
Problem:  URLs in :Tutor use "http" instead of "https".
Solution: Update URLs with a valid "https" equivalent.
2024-02-16 20:54:32 +08:00
zeertzjq
615b48aca6 fix(runtime): add more Nvim-only highlight groups to Vim syntax 2024-02-16 19:06:10 +08:00
zeertzjq
608f238bc6 vim-patch:1633de8c35fd
runtime(vim): Update base-syntax, remove unused vimString region

These were included with the initial release of the syntax file for Vim
5 and were probably intended to allow for syn-region start/skip/end
patterns with a '!' or '+' delimiter.  However, these cases are
currently handled by the vimSynRegPat group.

The removed patterns never match anywhere in the distributed runtime
files and it is believed that this is generally true.

closes: vim/vim#14035

1633de8c35

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-02-16 19:06:10 +08:00
zeertzjq
18dfe175e7 vim-patch:fe6d5b0ae47e
runtime(vim): Update base-syntax, fix :behave highlighting

closes: vim/vim#14036

fe6d5b0ae4

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-02-16 19:06:10 +08:00
zeertzjq
7751ff7394 vim-patch:5c3855bcab42
runtime(vim): update Vim Syntax generator

- Add missing "Last Change:" line.
- The date on this line in vim.vim is updated by update_date.vim at
  Make time. (I made a mistake in the file path)
- Remove unnecessary "b:loaded_syntax_vim_ex".
- Remove "Base File Date:" line in vim.vim.base
- Add Doug Kearns as Maintainer

closes: vim/vim#14031

5c3855bcab

Co-authored-by: h-east <h.east.727@gmail.com>
2024-02-16 19:06:10 +08:00
zeertzjq
2a6c7d0ccc vim-patch:9b53c052d58f
runtime(vim): include Vim Syntax generator

fixes: vim/vim#13939
closes: vim/vim#14021
related: vim-jp/syntax-vim-ex#28

9b53c052d5

Omit the generator as it cannot be used for Nvim.
Keep vimHLGroup and vimOnlyHLGroup separate.

N/A patch:
vim-patch:b418a51933bb

Co-authored-by: h-east <h.east.727@gmail.com>
2024-02-16 19:05:57 +08:00
zeertzjq
5de14b7206 vim-patch:ceed36873e92
runtime(vim): accept dot in completionList for Vim9 syntax (vim/vim#13832)

if you have autoloaded command complete function in vim9script, it shouldn't be highlighted as Error:

```
import autoload "share.vim"
command! -range=% -nargs=? -complete=custom,share.Complete Share share.Paste(<q-args>, <line1>, <line2>)
```

`share.Complete` is a valid complete function.

ceed36873e

Co-authored-by: Maxim Kim <habamax@gmail.com>
2024-02-16 19:05:50 +08:00
Christian Clason
422b090e0c vim-patch:79230f027a25
runtime(less): update "Last Change:" header

Commit 103f1dfb7df350650a5d7caadb0364bd79e9d25b forgot to update the
"Last Change:" header. So update it now.

79230f027a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-02-16 08:57:45 +01:00
Christian Clason
a1d977d8eb vim-patch:103f1dfb7df3
runtime(less): reset readonly setting when disabling less mode

While at it, also do the unmap only if a specific key has been mapped.
There are some keys that are only selectively mapped and it would cause
an error if we are trying to unmap such a key (e.g. z when your
foldmethod is not manual).

fixes: vim/vim#14040

103f1dfb7d

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-02-16 08:57:45 +01:00
Gregory Anders
55a4aa41bb
docs: document breaking change for nvim_create_autocmd callback (#27484)
https://github.com/neovim/neovim/pull/27428 changed the semantics of
callbacks passed to nvim_create_autocmd such that any truthy value will
delete the autocommand (rather than just the literal boolean value
`true`). Update the documentation accordingly and add an entry to
`news.txt`.

The behavior is now consistent between nvim_create_autocmd and
nvim_buf_attach.
2024-02-15 19:56:58 -06:00
Lewis Russell
35f453f65d fix: type warnings in shared.lua 2024-02-15 11:32:50 +00:00
Christian Clason
0a51e7626a vim-patch:9.1.0111: filetype: no support for bats files
The '*.bats' file type is for Bash Automated Testing System (BATS)
scripts. BATS scripts are Bash with a special '@test' extension but they
otherwise work with Vim's bash filetype.

See https://github.com/bats-core/bats-core

closes: vim/vim#14039

d00fb4b3a2

Co-authored-by: Brandon Maier <brandon.maier@collins.com>
2024-02-15 10:01:16 +01:00
Christian Clason
d0599b0ed9 vim-patch:9.1.0110: filetype: add 'Config.in' filetype detection
The 'Config.in' file type is for Buildroot configuration files.
Buildroot Config.in files use the same Kconfig backend as the Linux
kernel's Kconfig files.

Buildroot also has other filename variants that follow "Config.in.*",
they are used to distinguish multiple Config.in files in the same
directory.

See https://buildroot.org/downloads/manual/manual.html#_literal_config_in_literal_file

closes: vim/vim#14038

5f20f050ef

Co-authored-by: Brandon Maier <brandon.maier@collins.com>
2024-02-15 10:01:16 +01:00
Christian Clason
7ed75d410a vim-patch:9.1.0109: filetype: no support for its files
Problem:  filetype: no support for its files
Solution: Add detection for *.its files as dts file type
          (Brandon Maier)

The '*.its' file type is for U-Boot Flattened Image Trees (FIT) which
use the flattened devicetree format.

See https://github.com/u-boot/u-boot/blob/master/doc/usage/fit/source_file_format.rst#terminology

closes: vim/vim#14037

cf1d65e060

Co-authored-by: Brandon Maier <brandon.maier@collins.com>
2024-02-15 10:01:16 +01:00
Christian Clason
4f07ad7786 vim-patch:9.1.0108: filetype: no support for dtso files
Problem:  filetype: no support for dtso files
Solution: Add detection for *.dtso files as dts file type
          (Markus Schneider-Pargmann)

*.dtso files are devicetree overlay files which have the same syntax as dts or dtsi files.

closes: vim/vim#14026

b1700fb33f

Co-authored-by: Markus Schneider-Pargmann <msp@baylibre.com>
2024-02-15 10:01:16 +01:00
Christian Clason
989312ed84 vim-patch:1da0e8581671
runtime(asciidoc): include basic ftplugin

closes: vim/vim#13873

1da0e85816

Co-authored-by: Luca Saccarola <github.e41mv@aleeas.com>
2024-02-15 10:00:59 +01:00
zeertzjq
31b3c62845 vim-patch:9.1.0106: Visual highlight hard to read with 'termguicolors'
Problem:  Visual highlight hard to read with 'termguicolors'
          (Maxim Kim)
Solution: Set Visual GUI foreground to black (with background=light)
          and lightgrey (with background=dark)
          (Maxim Kim)

fixes: vim/vim#14024
closes: vim/vim#14025

34e4a05d02

Co-authored-by: Maxim Kim <habamax@gmail.com>
2024-02-15 10:50:29 +08:00
zeertzjq
440ce0d246 vim-patch:9.1.0068: Visual highlighting can still be improved
Problem:  Visual highlighting can still be improved
Solution: Update Visual highlighting for 8 color terminals,
          use uniform grey highlighting for dark and light bg
          (Maxim Kim)

Update terminal Visual

1. Use `ctermbg=Grey ctermfg=Black` for both dark and light

This uniforms Visual highlighting between default dark and light colors
And should work for vim usually detecting light background for terminals
with black/dark background colors.

Previously used `ctermfg=White` leaks `cterm=bold` if available colors
are less than 16.

2. Use `term=reverse cterm=reverse ctermbg=NONE ctermfg=NONE`
   for terminals reporting less than 8 colors available

If the terminal has less than 8 colors, grey just doesn't work right

closes: vim/vim#13940

59bafc8171

Co-authored-by: Maxim Kim <habamax@gmail.com>
2024-02-15 07:49:23 +08:00
Tomasz N
d09957e0a0
fix(lsp): rename: load and list new buffer if attached to window (#27408) 2024-02-14 21:11:29 +01:00
Lewis Russell
9f8c96240d refactor(lsp): resolve the config-client entanglement
Previously the LSP-Client object contained some fields that are also
in the client config, but for a lot of other fields, the config was used
directly making the two objects vaguely entangled with either not having
a clear role.

Now the config object is treated purely as config (read-only) from the
client, and any fields the client needs from the config are now copied
in as additional fields.

This means:
- the config object is no longet normalised and is left as the user
  provided it.
- the client only reads the config on creation of the client and all
  other implementations now read the clients version of the fields.

In addition, internal support for multiple callbacks has been added to
the client so the client tracking logic (done in lua.lsp) can be done
more robustly instead of wrapping the user callbacks which may error.
2024-02-13 14:49:20 +00:00
bfredl
1a3a8d903e refactor(lua): use a keyset for vim.diff opts parsing 2024-02-13 11:54:44 +01:00
bfredl
0353dd3029 refactor(lua): use Arena when converting from lua stack to API args
and for return value of nlua_exec/nlua_call_ref, as this uses
the same family of functions.

NB: the handling of luaref:s is a bit of a mess.
add api_luarefs_free_XX functions as a stop-gap as refactoring
luarefs is a can of worms for another PR:s.

as a minor feature/bug-fix, nvim_buf_call and nvim_win_call now preserves
arbitrary return values.
2024-02-13 11:54:44 +01:00
Jongwook Choi
89135cff03 fix(loader): remove cyclic dependency on vim.fs (when --luamod-dev)
Problem: Loading `vim.fs` via the `vim.loader` Lua package loader will
result in a stack overflow due to a cyclic dependency. This may happen
when the `vim.fs` module isn't byte-compiled, i.e. when `--luamod-dev`
is used (#27413).

Solution: `vim.loader` depends on `vim.fs`. Therefore `vim.fs` should
be loaded in advance.
2024-02-13 10:29:22 +00:00
Jongwook Choi
309c36d3c9 docs(builtin): fix lua types for vim.fn.sign_getplaced
Per :help sign_getplaced():

- Parameter {dict}: lnum also accepts integer as well as string
- Return value: item has field bufnr, not buf
2024-02-13 08:22:32 +00:00
Maria José Solano
1c7b0b9d5f
docs: stricter bufname and bufnr types (#27454) 2024-02-13 12:15:27 +08:00
Lewis Russell
597ecf7516 fix(lsp): re-add client.commands and mark private 2024-02-12 13:18:23 +01:00
altermo
6c168c0f4d
docs: correct on_key docs (#27429) 2024-02-12 20:03:53 +08:00
Lewis Russell
917172dd96 fix(lsp): semantic token defer loading
Fixes #27424
2024-02-12 09:31:48 +00:00
zeertzjq
950a0ac61c
vim-patch:b614b284ee06 (#27433)
runtime(vim): Update syntax file (vim/vim#14009)

- allow comments after :highight commands
- match the bang in a :highlight[!] command
- highlight the bang in :map[!], :menu[!] and :unlet[!] with vimOper
  like all other commands

b614b284ee

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-12 06:56:48 +08:00
Christian Clason
46390635cd vim-patch:6d91227267a5
runtime(gpg): Mark dangerous use-embedded-filename with WarningMsg

The syntax highlighter is likely to encourage people to use the listed
commands.

But `use-embedded-filename` is a dangerous option that can cause GnuPG
to write arbitrary data to arbitrary files whenever GnuPG encounters
malicious data.

GnuPG upstream explicitly warns against using this option:

https://dev.gnupg.org/T4500
https://dev.gnupg.org/T6972

However, since this is a valid option, we cannot just drop it from the
syntax script. Instead, let's mark it with the WarningMsg highlighting
to make it obvious, that this option is different (and should not be
used for security reasons).

closes: vim/vim#13961

6d91227267

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2024-02-11 20:09:43 +01:00
Lewis Russell
ed1b66bd99
refactor(lsp): move more code to client.lua
The dispatchers used by the RPC client should be defined in the client,
so they have been moved there. Due to this, it also made sense to move
all code related to client configuration and the creation of the RPC
client there too.

Now vim.lsp.start_client is significantly simplified and now mostly
contains logic for tracking open clients.

- Renamed client.new -> client.start
2024-02-11 12:37:20 +00:00
Lewis Russell
8e86193502
Merge pull request #27420 from MariaSolOs/warning-anxiety
refactor(lsp): fix type annotations and add shared diagnostic helper
2024-02-11 11:42:21 +00:00
Maria José Solano
eac7e3fc6c refactor(lsp): add vim.lsp.sync.Range type 2024-02-10 20:05:47 -08:00
Maria José Solano
5a6868c888 refactor(lsp): add shared diagnostic handler 2024-02-10 20:05:47 -08:00
Maria José Solano
c73d67d283 refactor(lsp): add type annotations 2024-02-10 20:05:47 -08:00
Trevor Arjeski
170c890dca
feat(shortmess): "q" flag fully hides recording message (#27415)
When "q" is set in 'shortmess' it now fully hides the "recording @a" message
when you are recording a macro instead of just shortening to "recording". This
removes duplication when using reg_recording() in the statusline.

Related #19193
2024-02-11 07:39:39 +08:00
bfredl
320eec496c
Merge pull request #27253 from MariaSolOs/codelens-refresh
feat(lsp): add opts to vim.lsp.codelens.refresh
2024-02-10 21:48:45 +01:00
Christian Clason
71429c90ee build(deps): bump tree-sitter-bash to v0.20.5 2024-02-10 14:49:09 +01:00
Pablo Arias
8e739af064
fix(startup): multiprocess startuptime #26790
Problem:
Since 2448816956, the --startuptime report shows
two blocks of data. The TUI process and its embedded nvim process write to the
file concurrently, which may interleave the two startup sequences into the same
timeline.

Solution:
Report each process as a separate section in the same file.
1. Each process buffers the full report.
2. After startup is finished, the buffer is flushed (appended) to the file.

Fix #23036
Sample report:

    --- Startup times for process: Primary/TUI ---

    times in msec
     clock   self+sourced   self:  sourced script
     clock   elapsed:              other lines

    000.006  000.006: --- NVIM STARTING ---
    000.428  000.422: event init
    000.728  000.301: early init
    ...
    005.880  000.713: init highlight
    005.882  000.002: --- NVIM STARTED ---

    --- Startup times for process: Embedded ---

    times in msec
     clock   self+sourced   self:  sourced script
     clock   elapsed:              other lines

    000.006  000.006: --- NVIM STARTING ---
    000.409  000.403: event init
    000.557  000.148: early init
    000.633  000.077: locale set
    ...
    014.383  000.430: first screen update
    014.387  000.003: --- NVIM STARTED ---
2024-02-09 14:56:52 -08:00
Will Hopkins
44ec4b5b18
refactor: rename FloatConfig to WinConfig #27397
`FloatConfig` is no longer used only for floats, so the name is counterintuitive.

Followup to #25550
2024-02-09 08:17:10 -08:00
Maria José Solano
0fe86f7e24 feat(lsp): add opts paramater to vim.lsp.codelens.refresh 2024-02-08 20:24:40 -08:00
ite-usagi
32b49448b2
feat(tutor): add Japanese tutor #27268
Add Japanese Tutor
2024-02-08 14:43:18 -08:00
Tomasz N
f0e61e6d92
fix(lsp): rename fails on missing parent directory #27291
Problem:
If a rename results in a path that has missing parent directory(s), it
will fail.

Solution:
Do a recursive mkdir before attempting the rename.
2024-02-08 13:06:54 -08:00
Lewis Russell
451bc50d40 feat(lsp): deprecate severity_limit
Problem:
  `vim.lsp.diagnostic.on_diagnostic` accepts an undocumented severity_limit
  option which is widely used.

Solution:
  Deprecate it in favour of `{min = severity}` used in `vim.diagnostic`.
  Since this is undocumented, the schedule for removal is accelerated to
  0.11.
2024-02-08 16:58:49 +00:00
Jongwook Choi
d0e9e36a78 refactor(treesitter): {start,stop} are optional in Query:iter_* methods
Document that the `start` and `stop` parameters in
`Query:iter_captures()` and `Query:iter_matches()` are optional.

The tree-sitter lib has been bumped up to 0.20.9, so we also no longer
need "Requires treesitter >= 0.20.9".
2024-02-08 12:42:19 +00:00
Jongwook Choi
800134ea5e refactor(treesitter): typing for Query, TSQuery, and TSQueryInfo
- `TSQuery`: userdata object for parsed query.

- `vim.treesitter.Query`: renamed from `Query`.
  - Add a new field `lang`.

- `TSQueryInfo`:
  - Move to `vim/treesitter/_meta.lua`, because C code owns it.
  - Correct typing for `patterns`, should be a map from `integer`
    (pattern_id) to `(integer|string)[][]` (list of predicates or
    directives).

- `vim.treesitter.QueryInfo` is added.
  - This currently has the same structure as `TSQueryInfo` (exported
    from C code).
  - Document the fields (see `TSQuery:inspect`).

- Add typing for `vim._ts_parse_query()`.
2024-02-08 12:40:16 +00:00
Lewis Russell
1f9da3d083 refactor(lsp): tidy up logging 2024-02-08 11:11:46 +00:00