Commit Graph

33409 Commits

Author SHA1 Message Date
glepnir
22df649210 fix(api): nvim_create_user_command addr option should allow ranges #35077
Problem: Using `addr` without `range` in nvim_create_user_command gives
"No range allowed" error, inconsistent with `:command -addr` behavior.

Solution: Set EX_RANGE flag when `addr` option is specified to match
`:command` behavior.
2025-08-02 19:52:54 -07:00
Justin M. Keyes
93f5bd0caf Merge #35052 test(pack): vim.pack 2025-08-02 19:35:42 -04:00
Phạm Bình An
3f416ef524 build: bump lua-bitop to 1.0.3 #35063
Source: https://bitop.luajit.org/download.html
2025-08-02 15:58:11 -07:00
Evgeni Chasnovski
6e27200901 test(pack): add vim.pack tests 2025-08-02 15:00:42 +03:00
Evgeni Chasnovski
52a596b0aa ci: enable integration tests on Release builds 2025-08-02 15:00:42 +03:00
Evgeni Chasnovski
2e62f3576f fix(pack): open confirmation buffer in tabpage after the current one 2025-08-02 15:00:42 +03:00
Evgeni Chasnovski
d3bea4ace9 fix(pack): ensure consistent order of changelog during update
Problem: Left (`<` prefix) and right (`>` prefix) parts of update
  changelog come in not fixed order: it can be left-right or right-left.

Solution: Ensure left-right order.
2025-08-02 15:00:42 +03:00
Evgeni Chasnovski
89a72f11e5 fix(pack): make newer version suggestions more robust
Problem: New version suggestions in update confirmation buffer might
  include semver tags that were committed later but for versions that
  are not greater than current. Like if versions committed in order
  `v0.2.0` - `v0.3.0` - `v0.2.1` - `v0.3.1`, then when on `v0.3.0` both
  `v0.2.1` and `v0.3.1` are suggested, but only the latter is newer as
  a version. This is because those tags are computed with post-processed
  `git tag --list --contains HEAD`.

Solution: Compute all semver tags and filter only those greater than the
  latest version available at HEAD.
2025-08-02 15:00:42 +03:00
Evgeni Chasnovski
6721128cc8 refactor(pack): use vim.cmd methods with structured input 2025-08-02 15:00:42 +03:00
Evgeni Chasnovski
ed73ed8283 fix(pack): ensure explicit default version in events (where possible)
Problem: Both `PackChangedPre` and `PackChanged` contain |event-data|
  with plugin's `spec`. It looks like a good idea to have all its
  triggers contain the same format across all kinds ("install",
  "update", "delete"). There are several choices:
    - Have it be as verbatim as supplied to `vim.pack.add()`, i.e. can
      be either string or table. A bit too ambiguous.
    - Have it be table with `src` and `name` inferred. This requires
      less work for "install", but more work for "update" and "delete"
      (since they use `vim.pack.get()` which already infers default
      `version`).
    - Have it be table with *all* defaults made explicit. This looks
      like the best approach, but requires extra care to only infer
      default `version` when needed (i.e. avoid inferring during regular
      load) because it is costly in terms of startup time.
      This might also introduce inconsistency when dealing with
      lockfile(s) as information there should be as close to what user
      supplied as possible. Address that when dealing with lockfile.

Solution: Ensure explicit `version` in all events where possible.
2025-08-02 15:00:42 +03:00
Evgeni Chasnovski
8200223ee7 fix(pack): use vim.pack: as message/progress prefix 2025-08-02 15:00:41 +03:00
Evgeni Chasnovski
267bbe64cb fix(pack): validate installed plugins in update() and del()
Problem: Currently `update()` and `del()` silently ignore input plugin
  names that are not for already installed plugin. This might lead to
  confusion because they are not explicitly reported.

Solution: Check that all input names are for installed plugins and error
  otherwise.
2025-08-02 15:00:41 +03:00
Evgeni Chasnovski
a203961535 feat(pack): use colored nvim_echo chunks to show progress report
Problem: using `print()` to show progress report writes to `stdout` when
  in `--headless` mode (interferes with the testing output) and doesn't
  allow coloring.

Solution: use `nvim_echo` with colored chunks.
2025-08-02 15:00:41 +03:00
Evgeni Chasnovski
3f34f083db fix(pack): ignore 'loadplugins' when sourcing 'after/plugin' scripts
Problem: Sourcing of 'after/plugin' scripts depends on the value of
  'loadplugins' option. It is redundant, as it has effect only during
  startup, while it is combined with `vim.v.vim_did_enter == 1` (i.e.
  "it is after starting up") condition.

Solution: Ignore it.
2025-08-02 15:00:41 +03:00
Evgeni Chasnovski
28e2a5c151 fix(pack): improve vim.pack.add() input validation 2025-08-02 15:00:41 +03:00
Evgeni Chasnovski
1ee18b4061 fix(pack): use 'coxpcall.lua' on non-LuaJIT
Problem: `attempt to yield across metamethod/C-call boundary` error when
  trying to use `vim.pack.add()`.

Solution: use `pcall()` variant from 'coxpcall' on non-LuaJIT version of
  Lua.
2025-08-02 15:00:41 +03:00
zeertzjq
1240d29f8f vim-patch:b88f9e4: runtime(vim): Update base syntax, fix :map termination in :command RHS (#35131)
Ensure :map (and :abbreviate) terminate at | when included in :command
replacement strings containing commands separated by line continuations.

b88f9e4a04

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-08-02 19:35:21 +08:00
bfredl
94d09d6627 Merge pull request #35135 from bfredl/lazystatus
fix(statusline): don't require'vim.diagnostic' unless already used
2025-08-02 11:51:41 +02:00
bfredl
1af5ec5b51 fix(statusline): don't require'vim.diagnostic' unless already used
This workarounds a bug likely in nvim__get_runtime, and fixes #35124

Though I'd argue it is more correct anyway as the point of
vim.SUBMODULE lazy loading is "only pay for what you use". If no one
has require'vim.diagnostic' yet in LSP or otherwise, there cannot
be any diagostics available and loading the lua module is wasteful.
2025-08-02 11:26:35 +02:00
Eisuke Kawashima
68eece8b84 fix(diagnostic): check if the buffer is loaded #35125
fix #35116

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-07-31 19:53:53 -07:00
Anton Kastritskii
c3a4d12529 fix(statusline): check buf valid before redraw #35123
fixes #35116
2025-07-31 13:03:45 -07:00
Anton Kastritskii
b79ff967ac feat(statusline): vim.diagnostic.status() #33723
Problem:
Not easy to get a status string for diagnostics.

Solution:
- Add vim.diagnostic.status().
- Add it to the default 'statusline'.
2025-07-29 18:53:57 -07:00
Shadman
807a65b2da fix(prompt): cursor on prompt line, disallow ":edit" #34736
* fix: ensure :edit can not be use on prompt buffer
* fix: starting editing on prompt-line doesn't put cursor at the end
2025-07-29 18:36:01 -07:00
luukvbaal
1256daeead fix(extui): ensure windows are valid in scheduled on_key (#35106) 2025-07-29 23:03:38 +00:00
glepnir
15d57ab0ba fix(api): single-line visual block insert triggers extra on_lines #35098
Problem: Visual block insert on a single line incorrectly triggers two
on_lines callbacks - one for the correct line (0-indexed) and another
for a non-existent additional line.

Solution: Only call changed_lines() in block_insert() when additional
lines beyond the first were actually modified (start.lnum < end.lnum).
2025-07-29 06:24:44 -07:00
Justin M. Keyes
029b7a149f Merge #35000 docs: lsp, ui events, dev guidance 2025-07-28 22:23:07 -04:00
Justin M. Keyes
dc3a30cfbb fix(messages): 'exrc' / secure messages 2025-07-28 22:00:25 -04:00
Justin M. Keyes
c81dc320b0 docs: vim.pack 2025-07-28 22:00:25 -04:00
Justin M. Keyes
56a4ef3c21 docs: lsp, ui events, dev guidance, osc7
fix #34981
2025-07-28 22:00:25 -04:00
nyngwang
dc67ba948e feat(exrc): user must view and explicitly run ":trust" #35069
Problem:
It's relatively easy to mispress key `a` to (a)llow arbitrary execution
of 'exrc' files. #35050

Solution:
- For exrc files (not directories), remove "allow" menu item.
  Require the user to "view" and then explicitly `:trust` the file.
2025-07-28 13:11:58 -07:00
Lewis Russell
cf9b36f3d9 feat(lua): add vim.list.unique()
Problem:
No way to deduplicate values in a list in-place

Solution:
Add `vim.list.unique()`
2025-07-28 09:34:06 +01:00
Sergei Slipchenko
7a051a4c38 fix(diagnostics): avoid jumping to diagnostics in deleted ranges #35088
Problem:
diagnostic extmark used for positioning continues to exist after
deleting a range containing it, so it's possible to jump to a
next/previous diagnositc, which isn't visible in any way, including not
being shown via `open_float`.

Solution:
enable `invalidate` flag when setting an extmark to be able to filter
out diagnostics based on `invalid` flag when looking for next/previous
diagnostic to jump to.
2025-07-28 05:24:10 +00:00
Siddhant Agarwal
5151f635ca feat: serverlist({peer=true}) returns peer addresses #34806
Problem:
serverlist() only lists servers that were started by the current Nvim.

Solution:
Look for other Nvim servers in stdpath("run").
2025-07-27 21:40:04 -07:00
Maria José Solano
d08b265111 feat(lsp): enable document_color by default #35086 2025-07-27 17:11:28 -07:00
TheBlob42
628d569a59 fix(snippet): jumping backwards to choice node (#35062)
Avoid duplicate text when jumping back to a choice node. Set cursor to
end of tabstop range and prioritize current choice in completion items.
2025-07-27 16:10:00 -04:00
TheBlob42
dff78f580d fix(snippet): setting end_right_gravity (#35061)
When right_gravity is set to true for deactivating tabstop expansion we
have to set end_right_gravity to false to avoid expanding the tabstop
region on the right side. Vice versa for activating tabstop expansion
again.
2025-07-27 12:19:01 -07:00
Maria José Solano
afebbd0f34 fix(lsp): don't override config.title in vim.lsp.buf.signature_help() #35075 2025-07-26 19:47:28 -07:00
Jaehwang Jung
b4ba27c238 fix(lsp): codelens extmark line out of range (#35070)
Problem:
When setting extmark for a codelens after it's asynchronously resolved,
the line may have been removed, raising "invalid 'line': out of range"
error. This is a regression from #34888.

Solution:
Re-introduce the line count check.
2025-07-26 12:58:51 -07:00
Christian Clason
8a7bfdc079 build(deps): bump luajit to 871db2c84 2025-07-26 11:54:09 +02:00
bfredl
af5ac7c7ea fix(unittests): use -1ULL to mean UNSIGNED MATH.MAX 2025-07-26 11:54:09 +02:00
zeertzjq
5de2ec76a3 fix(cmdline): :checkhealth completion with multiple args (#35060) 2025-07-26 07:04:32 +08:00
Sergei Slipchenko
0a113013fb fix(diagnostics): position diagnostics using extmarks #34014
Problem:
Diagnostic positions are not being updated after text changes, which
means `vim.diagnostic.open_float` and `vim.diagnostic.jump` will work
with outdated positions when text is changed until diagnostics are
updated again (if ever).

Solution:
Create extmarks in `vim.diagnostic.set` and use their positions for
`vim.diagnostic.open_float` and `next_diagnostic` (used by
`vim.diagnostic.jump`, `vim.diagnostic.get_next` and
`vim.diagnostic.get_prev`).
2025-07-25 07:56:50 -07:00
Mike
e4a100a1e1 fix(diagnostics): extend conversion support from/to quickfix format (#34006)
Use uppercase to check severity
Mark quickfix items as valid when converting from diagnostics
Support nr/code attribute between formats
2025-07-25 08:14:00 -05:00
zeertzjq
1f7432a272 vim-patch:714671d: runtime(misc): use :hor :term to ensure new term window is split horizontally (#35064)
Problem:  :term splits new window above in vim, but in nvim it change
          the buffer for current window
Solution: :hor term to ensure consistent splitting for Vim and Neovim

closes: vim/vim#17822

714671de35

Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
2025-07-25 18:44:56 +08:00
phanium
e512efe369 fix(extui): attempt to perform arithmetic on field 'last_emsg' (#35047)
Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
2025-07-24 11:45:41 +00:00
zeertzjq
6190b6bc1d Merge pull request #35023 from janlazo/vim-9.1.1453
vim-patch:8.2.{2905,2906,2927},9.0.{2023,2042},9.1.{63,1453}
2025-07-24 12:29:07 +08:00
Jan Edmund Lazo
3e655d3e42 vim-patch:9.1.0063: GTK code can be improved
Problem:  GTK code can be improved
Solution: Improve GTK code for initial Wayland support
          (lilydjwg)

related: vim/vim#9639

94ff09a093

vim-patch:9.1.1453: tests: Test_geometry() may fail

Problem:  tests: Test_geometry() may fail
          (Gary Johnson)
Solution: allow a slightly smaller value when checking the number of
          lines.

fixes: vim/vim#17491

e965b7ac5f

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: lilydjwg <lilydjwg@gmail.com>
2025-07-23 23:35:44 -04:00
Yochem van Rosmalen
35af766de6 refactor(lua): use vim.system #34707 2025-07-23 20:03:30 -07:00
Sathya Pramodh
54b8c99e51 feat: ":restart +cmd" #34788
Problem:
":restart" always executes ":qall" to exit the server.

Solution:
Support ":restart +cmd" so the user can control the command
used to exit the server.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-07-23 19:45:31 -07:00
Yochem van Rosmalen
0dcdd65dcc fix(shada): check return value is 0
Problem:
Vimscript functions return number to signal ok/error. Lua doesn't
convert these to be falsey.

Solution:
Explicitly check if the return value is 0.
2025-07-23 13:57:27 +02:00