Commit Graph

3045 Commits

Author SHA1 Message Date
errael
b34e137e43
feat(lua): allow vim.on_key() callback to consume the key (#30939) 2024-11-01 09:11:15 +08:00
Lewis Russell
be04bbf781 refactor(loader): format annotations 2024-10-31 15:20:29 +00:00
Lewis Russell
086e598a6e refactor(loader): use the term stat instead of hash 2024-10-31 15:20:29 +00:00
Lewis Russell
8d68d883a9 refactor(loader): remove Loader table and use locals 2024-10-31 15:20:29 +00:00
Lewis Russell
4a0010e267 refactor(loader): rename types 2024-10-31 15:20:29 +00:00
Lewis Russell
7ccdd9235a refactor(loader): inline Loader.load into Loader.loadfile 2024-10-31 15:20:29 +00:00
Lewis Russell
ab2f2461b5 refactor(loader): simplify Loader.loader_lib 2024-10-31 15:20:27 +00:00
Lewis Russell
53536be62a refactor(loader): simplify Loader.write/read 2024-10-31 15:02:12 +00:00
Lewis Russell
f8fc6cb157 perf(loader): reduce calls to Loader.cache_file 2024-10-31 15:02:08 +00:00
Lewis Russell
03118c46ab refactor(loader): remove unused _topmods 2024-10-31 14:15:09 +00:00
Lewis Russell
1d4ba8c1ed fix: another round of type annotation fixes 2024-10-31 11:55:23 +00:00
Christian Clason
82e5066a7f vim-patch:9.1.0823: filetype: Zephyr overlay files not recognized
Problem:  filetype: Zephyr overlay files not recognized
Solution: detect '*.overlay' files as dts filetype,
          include syntax tests for DTS files
          (Xudong Zheng)

Reference:
https://docs.zephyrproject.org/latest/build/dts/howtos.html

closes: vim/vim#15963

a68bd6f089

Co-authored-by: Xudong Zheng <7pkvm5aw@slicealias.com>
2024-10-31 10:24:37 +01:00
notomo
b4599acbf8
fix(lsp): correct hover result handling (#30995)
Problem: vim.lsp.buf.hover() displays "No information available" when client_id
is not 1.

Solution: use vim.tbl_isempty(tbl) instead of #tbl==0
2024-10-30 16:57:33 +01:00
Gregory Anders
ff93cccbc1
fix(defaults): omit extraneous info from unimpaired mapping errors (#30983) 2024-10-29 10:06:14 -05:00
Kai Moschcau
4c7f5032af
docs(options): shell-powershell #30969
`-NonInteractive` at least somewhat hints to pwsh/powershell, that shell
sessions created from :! are not interactive, though even that is not
foolproof, because powershell is weird.
`$PSStyle.OutputRendering='plaintext'` causes pwsh/powershell
to omit ANSI escape sequences in its output.
2024-10-29 07:36:58 -07:00
Lewis Russell
2cd6abf0d7
Merge pull request #30935 from lewis6991/feat/lsp_multi_hover 2024-10-29 09:51:14 +00:00
Lewis Russell
8260e4860b feat(lsp)!: multiple client support for vim.lsp.buf.hover()
Deprecate `vim.lsp.handlers.hover` and `vim.lsp.handlers['textDocument/hover']`
2024-10-29 09:06:05 +00:00
Lewis Russell
1471dfc859 refactor(lsp): buf_request_all 2024-10-29 09:06:05 +00:00
zeertzjq
60b3ccd850 vim-patch:9.1.0821: 'findexpr' completion doesn't set v:fname to cmdline argument
Problem:  'findexpr' completion doesn't set v:fname to cmdline argument.
Solution: Set v:fname to the cmdline argument as-is (zeertzjq).

closes: vim/vim#15934

20e045f781
2024-10-29 08:20:00 +08:00
zeertzjq
378d9135e7 vim-patch:9.1.0810: cannot easily adjust the |:find| command
Problem:  cannot easily adjust the |:find| command
Solution: Add support for the 'findexpr' option (Yegappan Lakshmanan)

closes: vim/vim#15901
closes: vim/vim#15905

aeb1c97db5

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-10-29 08:20:00 +08:00
Nikita Revenco
0b7cc014fc
feat(defaults): map gO to LSP document_symbol #30781 2024-10-28 06:29:29 -07:00
Maria José Solano
0086ee90dd
fix(lsp): list all workspace folders in healthcheck #30966 2024-10-28 06:14:56 -07:00
Donatas
a9e725b26e
feat(diagnostics)!: sort underline severity_sort (#30898)
feat(diagnostics)!: sort underline with severity_sort

BREAKING CHANGE: underline will be applied with a higher value than `vim.hl.priorities.diagnostics`
2024-10-27 11:36:39 -05:00
Gregory Anders
adf7c98d60
fix(lsp): compare URI instead of workspace folder name (#30962)
The workspace folder name is meant to be a human-readable name which is
only used in the UI. Comparing the name against root_dir is thus not
a valid comparison. Instead, we should compare the workspace folder's
URI against the root dir URI.
2024-10-27 11:35:45 -05:00
Maria José Solano
123c0b6b4e docs(lsp): document alternative for vim.lsp.util.jump_to_location 2024-10-27 09:26:52 +00:00
Riley Bruins
f60a1f9059 docs(treesitter): specify predicate boolean return value 2024-10-27 09:25:07 +00:00
Tristan Knight
25b53b593e
refactor(lsp): drop str_byteindex/str_utfindex wrappers #30915
* deprecate old signatures
* move to new str_byteindex/str_utfindex signature
* use single-underscore name (double-underscore is reserved for Lua itself)
2024-10-26 07:38:25 -07:00
Maria José Solano
01739d4673
fix(defaults): missing ]Q/[Q unimpaired mappings #30943 2024-10-25 06:45:27 -07:00
Lewis Russell
54249d051c feat(lsp): deprecate vim.lsp.buf.completion
Use `vim.lsp.completion.trigger()` instead'
2024-10-24 16:36:14 +01:00
Lewis Russell
7a7747f1e4 feat(lsp): deprecate execute_command with client:exec_cmd 2024-10-24 15:37:34 +01:00
Lewis Russell
39d79efa1e fix(lsp): better multi-client support for callHierarchy
Only ever display a dialogue box once.

Switch from vim.fn.inpulist to vim.ui.select

refactor(lsp): merge call and type hierarchy functions
2024-10-24 13:15:25 +01:00
Lewis Russell
c8d7d65679 fix(lsp): use correct method for prepareTypehierarchy
Regression from #30902
2024-10-24 13:15:25 +01:00
Mathias Fussenegger
3c51058d76 fix(lsp): set tagstack on jump via goto methods
Follow up to https://github.com/neovim/neovim/pull/30877
Fixes https://github.com/neovim/neovim/issues/30926
2024-10-24 13:43:49 +02:00
Lewis Russell
2dcbfe78fc fix(lsp.buf): use correct offset_encoding for all requests
Problem:

`lsp.buf_request` send the same params to all servers and many
calls to this pass PositionalParams which depends on the clients
offset_encoding. This can result with incorrect params being sent
to a server.

Solution:

`lsp.buf_request` `params` argument can now be passed as a function
which takes the client as the first argument. This is used in
lsp/buf.lua to construct correct params for each client request.
2024-10-24 10:53:06 +01:00
Lewis Russell
3275ae830d fix(lsp.protocal): improve typing of constants 2024-10-24 10:53:03 +01:00
Lewis Russell
2ee39b7eb4 refactor(lsp.buf): remove buf_request wrapper 2024-10-24 09:58:22 +01:00
Lewis Russell
ad4e14c201 refactor(lsp.buf): use alias for vim.lsp 2024-10-24 09:55:23 +01:00
Mathias Fussenegger
008782208d fix(lsp): handle mixed encoding in tagfunc params
Relates to https://github.com/neovim/neovim/issues/30034
2024-10-24 09:56:58 +02:00
Tristan Knight
230b0c7f02
feat(stdlib): overload vim.str_byteindex, vim.str_utfindex #30735
PROBLEM:
There are several limitations to vim.str_byteindex, vim.str_utfindex:
1. They throw given out-of-range indexes. An invalid (often user/lsp-provided)
   index doesn't feel exceptional and should be handled by the caller.
   `:help dev-error-patterns` suggests that `retval, errmsg` is the preferred
   way to handle this kind of failure.
2. They cannot accept an encoding. So LSP needs wrapper functions. #25272
3. The current signatures are not extensible.
    * Calling: The function currently uses a fairly opaque boolean value to
      indicate to identify the encoding.
    * Returns: The fact it can throw requires wrapping in pcall.
4. The current name doesn't follow suggestions in `:h dev-naming` and I think
   `get` would be suitable.

SOLUTION:
- Because these are performance-sensitive, don't introduce `opts`.
- Introduce an "overload" that accepts `encoding:string` and
  `strict_indexing:bool` params.

```lua
local col = vim.str_utfindex(line, encoding, [index, [no_out_of_range]])
```

Support the old versions by dispatching on the type of argument 2, and
deprecate that form.

```lua
vim.str_utfindex(line)                             -- (utf-32 length, utf-16 length), deprecated
vim.str_utfindex(line, index)                      -- (utf-32 index, utf-16 index), deprecated
vim.str_utfindex(line, 'utf-16')                   -- utf-16 length
vim.str_utfindex(line, 'utf-16', index)            -- utf-16 index
vim.str_utfindex(line, 'utf-16', math.huge)        -- error: index out of range
vim.str_utfindex(line, 'utf-16', math.huge, false) -- utf-16 length
```
2024-10-23 06:33:57 -07:00
dundargoc
3a86b60032 docs: misc
Co-authored-by: David Pedersen <limero@me.com>
Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: Leo Schlosser <Leo.Schlosser@Student.HTW-Berlin.de>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-10-23 14:13:42 +02:00
Maria José Solano
f6f2334ac2
fix(defaults): error messages UX for unimpaired mappings #30884 2024-10-23 04:40:12 -07:00
Christian Clason
02749de7d5 vim-patch:9.1.0809: filetype: petalinux config files not recognized
Problem:  filetype: petalinux config files not recognized
Solution: detect 'project-spec/*.conf' files as bitbake filetype
          (Wu, Zhenyu)

References:
https://www.amd.com/en/products/software/adaptive-socs-and-fpgas/embedded-software/petalinux-sdk.html

closes: vim/vim#15926

626b6ab486

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-10-23 10:00:52 +02:00
Lewis Russell
629a5b71b5 fix(lsp): support multiple clients in typehierarchy 2024-10-22 21:59:48 +01:00
Famiu Haque
07b4cb6ada
docs(options): remove description for hidden options #30903
Problem:
Hidden options are documented despite being no-ops.

Solution:
Remove docs for hidden options.
Move tags for options that we plan to restore, to ":help nvim-missing".
Move tags for permanently removed options, to ":help nvim-removed".
2024-10-22 09:14:01 -07:00
Christian Clason
a6d1165771 vim-patch:9.1.0796: filetype: libtool files are not recognized
Problem:  filetype: libtool files are not recognized
Solution: detect '*.{lo,la,lai}' as sh filetype
          (Wu, Zhenyu)

closes: vim/vim#15751

bfe568d8c4

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-10-22 08:55:39 +02:00
Christian Clason
b7779aad41 vim-patch:9.1.0795: filetype: Vivado memory info file are not recognized
Problem:  filetype: Vivado memory info file are not recognized
Solution: detect '*.mmi' memory info file as xml filetype
          (Wu, Zhenyu)

References: https://docs.amd.com/r/en-US/ug1580-updatemem/MMI-File-Syntax

closes: vim/vim#15906

0887e62bce

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-10-22 08:55:39 +02:00
Lewis Russell
c8e47f6480 fix(meta): do not use hyphens in param names
Fixes #30882
2024-10-21 12:09:33 +01:00
Lewis Russell
3572319b4c feat(vim.validate): improve fast form and deprecate spec form
Problem:

`vim.validate()` takes two forms when it only needs one.

Solution:

- Teach the fast form all the features of the spec form.
- Deprecate the spec form.
- General optimizations for both forms.
- Add a `message` argument which can be used alongside or in place
  of the `optional` argument.
2024-10-21 11:32:06 +01:00
Justin M. Keyes
18b43c331d refactor: rename vim.highlight => vim.hl
Problem:
- `vim.highlight` module does not follow `:help dev-name-common`, which
  documents the name for "highlight" as "hl".
- Shorter names are usually preferred.

Solution:
Rename `vim.highlight` to `vim.hl`.

This is not a breaking change until 2.0 (or maybe never).
2024-10-21 00:54:43 +02:00
Justin M. Keyes
960fdc775a fix(lua): vim.deprecate does not support major>0 2024-10-21 00:54:42 +02:00
Justin M. Keyes
c9c17fda80 feat(deprecations): vim._defer_deprecated_module() 2024-10-21 00:54:42 +02:00
Mathias Fußenegger
0083e03d6f
feat(lsp)!: support multiple clients in goto methods (#30877)
Relates to:

- https://github.com/neovim/neovim/issues/30034
- https://github.com/neovim/neovim/issues/17712
- https://github.com/neovim/neovim/issues/16363

Closes:

- https://github.com/neovim/neovim/issues/26936 (but only provides bufnr
  and method)
- https://github.com/neovim/neovim/issues/22318

Might fix: https://github.com/neovim/neovim/issues/30737
2024-10-20 23:40:44 +02:00
zeertzjq
9b8907d905
feat(float): allow enabling mouse for non-focusable window (#30844)
Problem:  Cannot allow mouse interaction for non-focusable float window.
Solution: Add a "mouse" field to float window config.
2024-10-20 22:18:26 +08:00
Mathias Fussenegger
dff684fdb3 feat(lsp)!: support multiple clients in lsp.buf.references
Relates to:

- https://github.com/neovim/neovim/issues/17712
- https://github.com/neovim/neovim/issues/30034
2024-10-20 14:43:22 +02:00
zeertzjq
3cf602486c
feat(terminal)!: make 'belloff' and 'visualbell' apply to terminal bell (#30859)
vim-patch:8.2.4744: a terminal window can't use the bell
vim-patch:8.2.4745: using wrong flag for using bell in the terminal

BREAKING CHANGE: Bells from :terminal are now silent by default, unless
'belloff' option doesn't contain "term" or "all".
2024-10-20 07:59:43 +08:00
Uthman Mohamed
f4b620c4e6
feat(vim.ui.open): support lemonade #30845 2024-10-18 02:22:15 -07:00
temhelk
564173e556 fix(lsp.util): wrong arguments to 'validate' function 2024-10-18 07:37:36 +01:00
Maria José Solano
31745b17e6 fix(types): add narrower vim.validate types 2024-10-18 07:36:54 +01:00
Lewis Russell
3f3e4837d5 perf(validate): use lighter version
- Also fix `vim.validate()` for PUC Lua when showing errors for values
  that aren't string or number.
2024-10-17 16:53:52 +01:00
Lewis Russell
fa6ab0d909
Merge pull request #30825 from lewis6991/refactor/lsputil 2024-10-17 13:35:02 +01:00
Lewis Russell
a18fa2f11c feat(lsp.util): minor codestyle 2024-10-17 12:52:46 +01:00
Lewis Russell
cbc82011ce feat(lsp.util): improve offset_encoding type annotations 2024-10-17 12:52:45 +01:00
Lewis Russell
e954a16063 feat(lsp.util): remove some variables 2024-10-17 12:52:45 +01:00
Lewis Russell
97119a2369 feat(lsp.util): use vim.w/b 2024-10-17 12:52:45 +01:00
Lewis Russell
3f87e222f7 feat(lsp.util): remove some aliases 2024-10-17 12:52:45 +01:00
Lewis Russell
8ad000ef7c feat(lsp.util): remove unneeded table 2024-10-17 12:52:45 +01:00
Lewis Russell
acbc6a7f91 fix(lsp.util): inconsistent handling of offset_encoding 2024-10-17 12:52:45 +01:00
Lewis Russell
ff1d7d4299 feat(lsp.util): get_bufs_with_prefix -> get_writeable_bufs 2024-10-17 12:52:45 +01:00
Lewis Russell
1944c0d610 feat(lsp.util): refactor get_border_size() 2024-10-17 12:52:45 +01:00
Lewis Russell
d44d36b8ff feat(lsp.util): simplify some bounds checking 2024-10-17 12:52:45 +01:00
Lewis Russell
0621718e3b feat(lsp.util): remove metatable in locations_to_items 2024-10-17 12:52:45 +01:00
Lewis Russell
f0973d4227 feat(lsp.util): refactor symbols_to_items()
- Remove the trivial function vim.lsp.util._get_symbol_kind_name()
  and its tests.
2024-10-17 12:52:45 +01:00
Lewis Russell
5bec7288a5 feat(lsp.util): remove uneeded do-end 2024-10-17 12:52:45 +01:00
Lewis Russell
1edfe5c09e feat(lsp.util): use vim.api alias 2024-10-17 12:52:45 +01:00
Lewis Russell
92e4e3fb76 feat(lsp.util): fix type errors 2024-10-17 12:52:44 +01:00
Lewis Russell
21151144c6 feat(meta): add type for quickfix entries 2024-10-17 10:54:19 +01:00
Jordan
ce678043e3
feat(lsp): show server name in code actions #30830
Problem:
If there are multiple LSP clients, it's not clear which actions are provided by which servers. #30710

Solution:
Show the server name next to each action (only if there are multiple clients).
2024-10-17 01:35:19 -07:00
zeertzjq
c89150241d vim-patch:6c2fc37: runtime(help): Update help syntax
This commit makaes the following changes to the vim help syntax:

- fix excessive URL detection in help, because `file:{filename}` in
  doc/options.txt is determined to be a URL.
- update highlighting N for :resize in help
- split Italian-specific syntax into separate help script
- highlight `Note` in parentheses in help
- update 'titlestring' behaviour in documentation for invalid '%' format

closes: vim/vim#15883

6c2fc377bf

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-17 07:55:55 +08:00
Tristan Knight
80e37aa533
fix(lsp): str_byteindex_enc bounds checking #30747
Problem:
Previously the index was only checked against the UTF8 length. This
could cause unexpected behaviours for strings containing multibyte chars

Solution:
Check indicies correctly against their max value before returning the
fallback length
2024-10-16 09:12:19 -07:00
Lewis Russell
0e8568d72c feat(lsp.util): remove lsp spec extract 2024-10-16 12:39:28 +01:00
Lewis Russell
0066dd0f65 feat(lsp.util): use faster version of vim.validate 2024-10-16 12:39:27 +01:00
Christian Clason
82b02ae2f2 fix(runtime): clean up one-off scripts
Problem: Some runtime files no longer spark joy.

Solution: Kondo the place up.

Still sparks _some_ joy (moved to new `runtime/scripts` folder):
* `macros/less.*`
* `mswin.vim`
* `tools/emoji_list.lua`

No longer sparks joy (removed):
* `macmap.vim` (gvimrc file; not useful in Nvim)
* `tools/check_colors.vim` (no longer useful with new default colorscheme and treesitter)
* `macros/editexisting.vim` (throws error on current Nvim)
* `macros/justify.vim` (obsolete shim for `packadd! justify`)
* `macros/matchit.vim` (same)
* `macros/shellmenu.vim` (same)
* `macros/swapmous.vim` (same)
2024-10-15 20:50:21 +02:00
xudyang1
ea5b748f24
feat(man.vim): "q" always closes window #30819 2024-10-15 08:34:50 -07:00
zeertzjq
84623dbe93
vim-patch:9.1.0785: cannot preserve error position when setting quickfix list (#30820)
Problem:  cannot preserve error position when setting quickfix lists
Solution: Add the 'u' action for setqflist()/setloclist() and try
          to keep the closes target position (Jeremy Fleischman)

fixes: vim/vim#15839
closes: vim/vim#15841

27fbf6e5e8

Co-authored-by: Jeremy Fleischman <jeremyfleischman@gmail.com>
2024-10-15 18:53:59 +08:00
Maria José Solano
e0a5c3bb58
fix(lsp): handle multiline signature help labels #30460 2024-10-15 02:36:04 -07:00
zeertzjq
dbd172e7e9 vim-patch:5bcfb5a: runtime(doc): add some docs for file-watcher programs
fixes: vim/vim#15733

5bcfb5a30c

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-10-15 08:21:19 +08:00
zeertzjq
9701cbf036 vim-patch:7b5e52d: runtime(doc): add preview flag to statusline example
Problem:  The standard statusline example is missing the preview flag
          "%w"
Solution: Add the preview flag "%w"

closes: vim/vim#15874

7b5e52d16f

Co-authored-by: saher <msaher.shair@gmail.com>
2024-10-15 08:19:46 +08:00
Christian Clason
d04d7bf65d vim-patch:9.1.0779: filetype: neomuttlog files are not recognized
Problem:  filetype: neomuttlog files are not recognized
Solution: detect '*.neomuttdebug' file as neomuttlog filetype,
          include neomuttlog syntax script (Richard Russon)

closes: vim/vim#15858

a2aa921f76

Co-authored-by: Richard Russon <rich@flatcap.org>
Co-authored-by: AvidSeeker <avidseeker7@protonmail.com>
2024-10-14 09:31:24 +02:00
Christian Clason
15aa27bc1f vim-patch:9.1.0778: filetype: lf config files are not recognized
Problem:  filetype: lf config files are not recognized
Solution: detect lfrc files as lf filetype, include a syntax
          script for lf files (Andis Spriņķis).

References:
- https://github.com/gokcehan/lf

closes: vim/vim#15859

0f146b7925

Co-authored-by: Andis Spriņķis <spr.andis@protonmail.com>
2024-10-14 08:27:37 +02:00
glepnir
2d24558c28
docs: update autotrigger description of vim.lsp.compleiton.BufferOpts (#30796)
Currently the behavior of autotrigger is not well documented.
2024-10-13 12:44:05 +02:00
Christian Clason
06625f9b3a vim-patch:9.1.0777: filetype: Some upstream php files are not recognized
Problem:  filetype: Some upstream php files are not recognized
Solution: Detect more config files from the PHP source
          distribution as filetype ini (nisbet-hubbard).

closes: vim/vim#15840

367499c5c3

Co-authored-by: nisbet-hubbard <87453615+nisbet-hubbard@users.noreply.github.com>
2024-10-13 00:46:29 +02:00
zeertzjq
45f8f957c0
docs(lua): clarify when on_key "typed" will be empty (#30774) 2024-10-12 12:20:06 +08:00
zeertzjq
0e42c81c7f
fix(lua): avoid recursive vim.on_key() callback (#30753) 2024-10-12 08:07:05 +08:00
Gregory Anders
26e765f905
feat(defaults): map gri to vim.lsp.buf.implementation() (#30764)
Continuing the default LSP maps under the "gr" prefix. Mnemonic: "i" for
"implementation".
2024-10-11 11:56:21 -05:00
Riley Bruins
d3193afc25 fix(treesitter): remove duplicate symbol names in language.inspect()
**Problems:**

- `vim.treesitter.language.inspect()` returns duplicate
  symbol names, sometimes up to 6 of one kind in the case of `markdown`
- The list-like `symbols` table can have holes and is thus not even a
  valid msgpack table anyway, mentioned in a test

**Solution:** Return symbols as a map, rather than a list, where field
names are the names of the symbol. The boolean value associated with the
field encodes whether or not the symbol is named.

Note that anonymous nodes are surrounded with double quotes (`"`) to
prevent potential collisions with named counterparts that have the same
identifier.
2024-10-11 18:15:07 +02:00
Riley Bruins
267c7525f7 feat(treesitter): introduce child_with_descendant()
This commit also marks `child_containing_descendant()` as deprecated
(per upstream's documentation), and uses `child_with_descendant()` in
its place. Minimum required tree-sitter version will now be `0.24`.
2024-10-11 17:29:45 +02:00
Justin M. Keyes
c3cb702ac7
fix(lsp): set 'smoothscroll' in docs hover #30748 2024-10-11 00:50:09 -07:00
Christian Clason
79c036747a vim-patch:9.1.0773: filetype: some Apache files are not recognized
Problem:  filetype: some Apache files are not recognized
Solution: Detect more config files from the Apache source
          distribution as filetype apache (nisbet-hubbard)

closes: vim/vim#15810

e58e9015cc

Co-authored-by: nisbet-hubbard <87453615+nisbet-hubbard@users.noreply.github.com>
2024-10-11 08:59:37 +02:00
zeertzjq
6f1601a1b9
vim-patch:9.1.0774: "shellcmdline" doesn't work with getcompletion() (#30750)
Problem:  "shellcmdline" doesn't work with getcompletion().
Solution: Use set_context_for_wildcard_arg() (zeertzjq).

closes: vim/vim#15834

85f36d61e0
2024-10-10 22:48:45 +00:00
Tomasz N
b3109084c2
fix(lsp): fix cursor position after snippet expansion (#30659)
Problem: on `CompleteDone` cursor can jump to the end of line instead of
the end of the completed word.

Solution: remove only inserted word for snippet expansion instead of everything
until eol.

Fixes #30656

Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2024-10-10 11:40:03 +02:00
zeertzjq
8450752f46 vim-patch:9.1.0771: completion attribute hl_group is confusing
Problem:  Currently completion attribute hl_group is combined with
          all items, which is redundant and confusing with kind_hlgroup
Solution: Renamed to abbr_hlgroup and combine it only with the abbr item
          (glepnir).

closes: vim/vim#15818

0fe17f8ffb

Co-authored-by: glepnir <glephunter@gmail.com>
2024-10-10 07:21:02 +08:00
zeertzjq
8ef3dd3afa
docs(lua): "vim.bo" is always equivalent to :setlocal (#30733)
vim.bo

    :lua vim.bo.textwidth = 80
    :setglobal textwidth?
      textwidth=0

:setlocal

    :setlocal textwidth=80
    :setglobal textwidth?
      textwidth=0

:set

    :set textwidth=80
    :setglobal textwidth?
      textwidth=80
2024-10-09 11:31:14 +00:00
Christian Clason
0264870c0a vim-patch:9.1.0769: filetype: MLIR files are not recognized
Problem:  filetype: MLIR files are not recognized
Solution: Detect '*.mlir' files as mlir filetype,
          include a mlir filetype plugin
          (Wu, Zhenyu)

closes: vim/vim#15826

347d43bd33

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-10-09 10:10:39 +02:00
zeertzjq
f449a38f6a
vim-patch:9.1.0770: current command line completion is a bit limited (#30728)
Problem:  current command completion is a bit limited
Solution: Add the shellcmdline completion type and getmdcomplpat()
          function (Ruslan Russkikh).

closes: vim/vim#15823

0407d621bb

Co-authored-by: Ruslan Russkikh <dvrussk@yandex.ru>
2024-10-09 08:14:18 +08:00
Justin M. Keyes
61f1b091ea
docs: dev-arch, focusable windows #30510
- 'statuscolumn' is no longer experimental
- add tags for popular searches on neovim.io
2024-10-07 08:27:38 -07:00
Justin M. Keyes
50f006b617
fix(lsp): tagfunc fails in unusual buffer #30700
Problem:
tagfunc failed in a weird buffer (either a directory or some other
non-file buffer, I don't remember):

    E987: Invalid return value from tagfunc
    E5108: Error executing lua …/runtime/lua/vim/lsp/util.lua:311: EISDIR: illegal operation on a directory
    stack traceback:

at this line:

    local data = assert(uv.fs_read(fd, stat.size, 0))

Solution:
Check for directory.
2024-10-07 08:25:13 -07:00
Justin M. Keyes
7335988ce6
docs: generate params/returns in builtin.txt #30654 2024-10-07 05:32:49 -07:00
zeertzjq
bf868e76e1
vim-patch:9.1.0762: 'cedit', 'termwinkey' and 'wildchar' may not be parsed correctly (#30704)
Problem:  'cedit', 'termwinkey' and 'wildchar' may not be parsed
          correctly
Solution: improve string_to_key() function in option.c
          (Milly)

- Problem: `^@` raises an error.
  Solution: Store as `<Nul>`.
- Problem: `<t_xx` does not raise an error.
  Solution: Raise an error if closing `>` is missing.
- Problem: Single `<` or `^` raises an error. It is inconvenient for users.
  Solution: They are stored as a single character.

closes: vim/vim#15811

a9c6f90918

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-07 02:22:52 +00:00
zeertzjq
d0dc2920e1
vim-patch:fd4e47e: runtime(doc): clarify the effect of 'startofline' option (#30701)
fixes: vim/vim#15794

fd4e47e06b

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-10-07 07:30:50 +08:00
Justin M. Keyes
27f3750817
feat(lsp): improve LSP doc hover rendering #30695
Problem:
- Some servers like LuaLS add unwanted blank lines after multiline
  `@param` description.
- List items do not wrap nicely.

Solution:
- When rendering the LSP doc hover, remove blank lines in each `@param`
  or `@return`.
  - But ensure exactly one empty line before each.
- Set 'breakindent'.
2024-10-06 12:20:40 -07:00
Justin M. Keyes
6628741ada
feat(docs): improve @see meta docstrings #30693 2024-10-06 09:12:35 -07:00
Christian Clason
9788b81d7e fix(runtime): fully port emoji_list to Lua
Problem: `runtime/tools/emoji_list.vim` is a Lua script masquerading as
Vimscript, which is unnecessary now that `:source` works for Lua files.

Solution: Remove Vimscript wrapper.
2024-10-06 12:44:50 +02:00
Justin M. Keyes
056009f741
fix(docs): markdown instead of vimdoc in meta docstrings #30680
LuaLS/meta docstrings expect markdown, not vimdoc. This matters for lists, codeblocks, etc.

Also, line length doesn't matter for docstrings.
2024-10-06 03:24:21 -07:00
Justin M. Keyes
8801b77ed0
fix(docs): missing @returns desc in _meta/api.lua #30673 2024-10-05 08:52:57 -07:00
Gregory Anders
289380bc40
fix(defaults): use "range" instead of "count" for some mappings (#30642)
Some commands don't accept "count" and only work with "range". It's not
clear why. The issue is tracked at [1], but this is a workaround for
now.

[1]: https://github.com/neovim/neovim/issues/30641
2024-10-04 10:34:21 -05:00
Justin M. Keyes
9a5bbaf813
docs: more @since annotations #30660 2024-10-04 08:12:17 -07:00
Jongwook Choi
d5ae5c84e9
feat(lua): completion for vim.fn, vim.v, vim.o #30472
Problem: Lua accessors for
- global, local, and special variables (`vim.{g,t,w,b,v}.*`), and
- options (`vim.{o,bo,wo,opt,opt_local,opt_global}.*`),

do not have command-line completion, unlike their vimscript counterparts
(e.g., `g:`, `b:`, `:set`, `:setlocal`, `:call <fn>`, etc.).

Completion for vimscript functions (`vim.fn.*`) is incomplete and does
not list all the available functions.

Solution: Implement completion for vimscript function, variable and
option accessors in `vim._expand_pat` through:

- `getcompletion()` for variable and vimscript function accessors, and
- `nvim_get_all_options_info()` for option accessors.

Note/Remark:

- Short names for options are yet to be implemented.

- Completions for accessors with handles (e.g. `vim.b[0]`, `vim.wo[0]`)
  are also yet to be implemented, and are left as future work, which
  involves some refactoring of options.

- For performance reasons, we may want to introduce caching for
  completing options, but this is not considered at this time since the
  number of the available options is not very big (only ~350) and Lua
  completion for option accessors appears to be pretty fast.

- Can we have a more "general" framework for customizing completions?
  In the future, we may want to improve the implementation by moving the
  core logic for generating completion candidates to each accessor (or
  its metatable) or through some central interface, rather than writing
  all the accessor-specific completion implementations in a single
  function: `vim._expand_pat`.
2024-10-04 06:48:31 -07:00
Yi Ming
305012ea07 fix(lsp): enable additionalPropertiesSupport 2024-10-04 12:22:46 +02:00
Justin M. Keyes
b45c50f314
docs: render @since versions, 0 means experimental #30649
An implication of this current approach is that `NVIM_API_LEVEL` should be
bumped when a new Lua function is added.

TODO(future): add a lint check which requires `@since` on all new functions.

ref #25416
2024-10-04 02:13:31 -07:00
Riley Bruins
f62728cd80
docs(treesitter): generate TSNode, TSTree docs #30643
**Problem:** The documentation for `TSNode` and `TSTree` methods is
incomplete from the LSP perspective. This is because they are written
directly to the vimdoc, rather than in Lua and generated to vimdoc.

**Solution:** Migrate the docs to Lua and generate them into the vimdoc.
This requires breaking up the `treesitter/_meta.lua` file into a
directory with a few different modules.

This commit also makes the vimdoc generator slightly more robust with
regard to sections that have multiple help tags (e.g. `*one* *two*`)
2024-10-03 16:57:19 -07:00
James Trew
385fbfb3e7
docs: improve luacats support #30580
Some composite/compound types even as basic as `(string|number)[]` are
not currently supported by the luacats LPEG grammar used by gen_vimdoc.
It would be parsed & rendered as just `string|number`.

Changeset adds better support for these types.
2024-10-03 03:45:51 -07:00
zeertzjq
4075e613b2
fix(defaults): properly pass count to quickfix commands (#30632) 2024-10-03 10:57:54 +08:00
zeertzjq
aeea63081c
vim-patch:ae62fe5: runtime(doc): 'filetype', 'syntax' and 'keymap' only allow alphanumeric + some characters (#30630)
closes: vim/vim#15783

ae62fe5c28

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-03 06:58:31 +08:00
glepnir
6a2f8958e8
vim-patch:9.1.0754: fixed order of items in insert-mode completion menu (#30619)
Problem:  fixed order of items in insert-mode completion menu
Solution: Introduce the 'completeitemalign' option with default
          value "abbr,kind,menu" (glepnir).

Adding an new option `completeitemalign` abbr is `cia` to custom
the complete-item order in popupmenu.

closes: vim/vim#14006
closes: vim/vim#15760

6a89c94a9e
2024-10-03 06:45:01 +08:00
Justin M. Keyes
9e23b4e185 fix(watch): ignore nonexistent paths (ENOENT)
Problem:
The `_watch.watch()` strategy may fail if the given path does not exist:

    …/vim/_watch.lua:101: ENOENT: no such file or directory
    stack traceback:
        [C]: in function 'assert'
        …/vim/_watch.lua:101: in function <…/vim/_watch.lua:61>
        [string "<nvim>"]:5: in main chunk

- `_watch.watch()` actively asserts any error returned by `handle:start()`.
- whereas `_watch.watchdirs()` just ignores the result of `root_handle:start()`.

Servers may send "client/registerCapability" with "workspace/didChangeWatchedFiles"
item(s) (`baseUri`) which do not actually exist on the filesystem:
https://github.com/neovim/neovim/issues/28058#issuecomment-2189929424

    {
      method = "client/registerCapability",
      params = {
        registrations = { {
            method = "workspace/didChangeWatchedFiles",
            registerOptions = {
              watchers = { {
                  globPattern = {
                    baseUri = "file:///Users/does/not/exist",
                    pattern = "**/*.{ts,js,mts,mjs,cjs,cts,json,svelte}"
                  }
                },
    ...
    }

Solution:
- Remove the assert in `_watch.watch()`.
- Show a once-only message for both cases.
- More detailed logging is blocked until we have `nvim_log` / `vim.log`.

fix #28058
2024-10-02 16:41:01 +02:00
zeertzjq
2168d772b8
vim-patch:9.1.0752: can set 'cedit' to an invalid value (#30616)
Problem:  can set cedit to an invalid value
Solution: Check that the value is a valid key name
          (Milly)

closes: vim/vim#15778

25732435c5

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-01 23:39:28 +00:00
Jongwook Choi
5331f87f61
fix(treesitter): indent size for inspect_tree #28727
Problem: For :InspectTree, indent size (`&shiftwidth`) for the tree
viewer may be incorrect.

This is because the tree viewer buffer with the filetype `query` does
not explicitly configures the tab size, which can mismatch with the
default indent size (2) assumed by TSTreeView's implementation.

Solution: Set shiftwidth to be the same as TSTreeViewOpts specifies,
which defaults to 2.
2024-10-01 09:07:30 -07:00
Gregory Anders
bb7604edda
feat(defaults): add default unimpaired style mappings (#28525) 2024-10-01 07:24:43 -05:00
Christian Clason
ea9d61b80d vim-patch:9.1.0749: filetype: http files not recognized
Problem:  filetype: http files not recognized
Solution: detect '*.http' as http filetype, include
          http filetype plugin (Riley Bruins)

Based on the specification found
[here](https://github.com/JetBrains/http-request-in-editor-spec/blob/master/spec.md)

closes: vim/vim#15762

de6c1d1182

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2024-10-01 07:33:08 +02:00
Lewis Russell
0fb5299e53 test: refactor exec_lua in xdiff_spec 2024-09-30 11:51:33 +01:00
Lewis Russell
c65646c247 fix(diff): use mmfile_t in linematch
Problem:

Linematch used to use strchr to navigate a string, however strchr does
not supoprt embedded NULs.

Solution:

Use `mmfile_t` instead of `char *` in linematch and introduce `strnchr()`.

Also remove heap allocations from `matching_char_iwhite()`

Fixes: #30505
2024-09-30 11:51:33 +01:00
Christian Clason
99e0facf3a feat(treesitter)!: use return values in language.add()
Problem: No clear way to check whether parsers are available for a given
language.

Solution: Make `language.add()` return `true` if a parser was
successfully added and `nil` otherwise. Use explicit `assert` instead of
relying on thrown errors.
2024-09-29 15:27:16 +02:00
Christian Clason
041d98fe8d feat(treesitter)!: add default fallback to ft_to_lang lookups
Problem: Language names are only registered for filetype<->language
lookups when parsers are actually loaded; this means users cannot rely
on `vim.treesitter.language.get_lang()` or `get_filetypes()` to return
the correct value when language and filetype coincide and always need to
add explicit fallbacks.

Solution: Always return the language name as valid filetype in
`get_filetypes()`, and default to the filetype in `get_lang()`. Document
this behavior.
2024-09-29 15:27:16 +02:00
dundargoc
2c937d723d
docs: misc (#30177)
Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Co-authored-by: Riley Bruins <ribru17@hotmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-09-29 09:54:12 +00:00
Christian Clason
1405034ba3 vim-patch:9.1.0745: filetype: bun and deno history files not recognized
Problem:  filetype: bun and deno history files not recognized
Solution: detect '.bun_repl_history' and 'deno_history.txt' as
          javascript filetype (Wu, Zhenyu)

closes: vim/vim#15761

8a2aea8a62

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-09-29 11:13:27 +02:00
Riley Bruins
4349bdbd0b fix(treesitter): specify success status in edit_query return value 2024-09-28 10:54:45 +02:00
Riley Bruins
0f067cd34d fix(treesitter): suppress get_parser warnings via opts.error 2024-09-28 00:31:45 +02:00
zeertzjq
60a7578058
vim-patch:9.1.0744: filetype: notmuch configs are not recognised (#30535)
Problem:  filetype: notmuch configs are not recognised
Solution: Detect more notmuch profile configuration files
          as dosini filetype (Julio B)

Reference:
https://notmuchmail.org/doc/latest/man1/notmuch-config.html#configuration

closes: vim/vim#15744

1a2870b57a

Co-authored-by: Julio B <julio.bacel@gmail.com>
2024-09-27 18:57:01 +08:00
Justin M. Keyes
b63cd8cbae
fix(treesitter): EditQuery shows swapfile ATTENTION #30536
Problem:
EditQuery shows swapfile ATTENTION, but this buffer is not intended for
preservation (and the dialog breaks the UX).

Solution:
Set 'noswapfile' on the buffer before renaming it.
2024-09-27 03:27:00 -07:00
Justin M. Keyes
f2fa4ca97e
feat(health): highlight headings #30525
Problem:
checkhealth report sections are not visually separated.

Solution:
Highlight with "reverse".

TODO: migrate checkhealth filetype to use treesitter.
TODO: default :help should also highlight headings more boldy!
2024-09-26 07:45:03 -07:00
zeertzjq
c2fb1fc700 vim-patch:9.1.0741: No way to get prompt for input()/confirm()
Problem:  No way to get prompt for input()/confirm()
Solution: add getcmdprompt() function (Shougo Matsushita)
          (Shougo Matsushita)

closes: vim/vim#15667

6908428560

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
2024-09-26 22:15:28 +08:00
Riley Bruins
64847fbdc9 perf(treesitter): use child_containing_descendant() in is_ancestor()
**Problem:** `is_ancestor()` uses a slow, bottom-up parent lookup which
has performance pitfalls detailed in #28512.

**Solution:** Take `is_ancestor()` from $O(n^2)$ to $O(n)$ by
incorporating the use of the `child_containing_descendant()` function
2024-09-25 23:01:08 +02:00
Nathan Smith
921dc22fc0
fix(diagnostic): correct severity type on setqflist, setloclist (#30506)
fix(diagnostic): correct severity type on setqflist, setloclist
2024-09-25 10:10:50 -05:00
Justin M. Keyes
f3b7444e66
refactor(lua): vim.keymap.set tests, docs #30511 2024-09-25 07:01:27 -07:00
Justin M. Keyes
ce7017b850
docs: render @see, @note items in _meta/api.lua #30494 2024-09-25 02:34:13 -07:00
Justin M. Keyes
3f6bc34e66
docs: lua error patterns #30240
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
Co-authored-by: Ananth Bhaskararaman <antsub@gmail.com>
2024-09-24 04:46:50 -07:00
zeertzjq
d831392b15
feat(paste): unify cancel and error behavior (#30476)
Before this PR, the behavior of nvim_paste is:
- When vim.paste() returns false, return false to the client, but treat
  following chunks normally (i.e. rely on the client cancelling the
  paste as expected).
- When vim.paste() throws an error, still return true to the client, but
  drain the following chunks in the stream without calling vim.paste().

There are two problems with such behavior:
- When vim.paste() errors, the client is still supposed to send the
  remaining chunks of the stream, even though they do nothing.
- Having different code paths for two uncommon but similar situations
  complicates maintenance.

This PR makes both the cancel case and the error case return false to
the client and drain the remaining chunks of the stream, which, apart
from sharing the same code path, is beneficial whether the client checks
the return value of nvim_paste or not:
- If the client checks the return value, it can avoid sending the
  following chunks needlessly after an error.
- If the client doesn't check the return value, chunks following a
  cancelled chunk won't be pasted on the server regardless, which leads
  to less confusing behavior.
2024-09-24 07:14:14 +08:00
Tristan Knight
032e024f8a
fix(filetype): handle .in files with no filename (#30487)
Problem:
fnamemodify with the :r flag will not strip extensions if the filename
starts with a ".". This means that files named ".in" could cause an
infinite loop.

Solution:
Add early return if the filename was not changed
2024-09-24 06:42:16 +08:00
Justin M. Keyes
34a40d3a50
Merge #30435 refactor: rename "Dictionary" => "Dict" 2024-09-23 07:14:10 -07:00
Justin M. Keyes
47e6b2233f
fix(vim.fs): dirname() returns "." on mingw/msys2 #30480
Problem:
`vim.fs.dirname([[C:\User\XXX\AppData\Local]])` returns "." on
mingw/msys2.

Solution:
- Check for "mingw" when deciding `iswin`.
- Use `has("win32")` where possible, it works in "fast" contexts since
  b02eeb6a72.
2024-09-23 06:05:58 -07:00