Commit Graph

33431 Commits

Author SHA1 Message Date
Jan Edmund Lazo
b869cf8ddc vim-patch:9.0.1689: python 3.12 produces warnings and fails test
Problem: python 3.12 produces warnings and fails test
Solution: Make use of raw strings in python3 tests

closes: vim/vim#12765

288bf26c53

Co-authored-by: Zdenek Dohnal <zdohnal@redhat.com>
2025-08-06 01:09:05 -04:00
Jan Edmund Lazo
cba2f65ee4 vim-patch:8.2.3602: Python3 test fails with Python 3.10 on MS-Windows
Problem:    Python3 test fails with Python 3.10 on MS-Windows.
Solution:   Adjust the expected error. (Ken Takata, closes vim/vim#9118)

1be7e21583

Co-authored-by: K.Takata <kentkt@csc.jp>
2025-08-06 01:07:11 -04:00
Jan Edmund Lazo
7ae8860674 vim-patch:8.2.1912: with Python 3.9 some tests fail
Problem:    With Python 3.9 some tests fail.
Solution:   Take into account the different error message. (James McCoy,
            closes vim/vim#7210)

68a48ee55e

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-05 13:33:59 -04:00
Jan Edmund Lazo
b95413f601 vim-patch:8.2.1555: not all tests are executed on Github Actions
Problem:    Not all tests are executed on Github Actions.
Solution:   Copy "src" to "src2" earlier. Recognize "src2" in a couple more
            places.  Add two tests to the list of flaky tests. (Ken Takata,
            closes vim/vim#6798)

7d6979608e

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-05 13:33:52 -04:00
Jan Edmund Lazo
474c477134 vim-patch:8.2.1123: Python 3 test is old style
Problem:    Python 3 test is old style.
Solution:   Turn into new style test. (Yegappan Lakshmanan, closes vim/vim#6385)

effb0cd75d

Neovim has Lua context that conflict with asserted error message.
Disable incompatible tests due to unsupported features from
python3 provider (ie. LegacyVim bindings, vim.bindeval).

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-05 13:33:44 -04:00
Jan Edmund Lazo
d632ffa243 vim-patch:8.2.0307: Python 3 vim.eval not well tested
Problem:    Python 3 vim.eval not well tested.
Solution:   Add a test. (Dominique Pelle, closes vim/vim#5680)

026270c01d

Amend float values to pass on Ubuntu.
Comment out failing cases (ie. v:none, blob).

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-05 13:33:10 -04:00
Jan Edmund Lazo
2a267d1cbf vim-patch:partial:8.2.1328: no space allowed before comma in list
Problem:    No space allowed before comma in list.
Solution:   Legacy Vim script allows it. (closes vim/vim#6577)

4d4d1cd5c8

Partial port to guard against v8.2.1326 regression.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-05 13:33:03 -04:00
Jan Edmund Lazo
758e6db06c vim-patch:8.2.0512: Vim9: no optional arguments in func type
Problem:    Vim9: no optional arguments in func type.
Solution:   Check for question mark after type.  Find function reference
            without function().

5deeb3f1f9

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-05 13:32:03 -04:00
Maria José Solano
a9a4c271b1 revert(lsp): compare to vim.NIL in lsp/buf.lua (#35156)
revert(lsp): "compare to `vim.NIL` in `lsp/buf.lua` #35154"

This reverts commit a5c598871b.
2025-08-03 18:20:17 -07:00
Maria José Solano
a5c598871b fix(lsp): compare to vim.NIL in lsp/buf.lua #35154 2025-08-03 15:39:49 -07:00
Maria José Solano
54bfd0de4f docs(lsp): mention default enablement of document colors (#35153) 2025-08-03 15:03:14 -07:00
Maria José Solano
c789d79966 fix(lsp): check if buffer is valid when resolving code lenses (#35092) 2025-08-03 14:11:18 -07:00
TheBlob42
ecded994c1 fix(snippet): early return for final tabstop #35115
The cursor movement autocommand can not detect when the final tabstop $0
is directly adjacent to another tabstop, which prevents ending the
snippet session. The fix is an early return when jumping.
2025-08-03 19:52:09 +00:00
Yi Ming
7ed8cbd095 feat(lua): vim.list.bisect() #35108 2025-08-03 07:45:49 -07:00
skewb1k
40aef0d02e fix(lsp): decode 'null' in server responses as vim.NIL #34849
Problem:
Previously, 'null' value in LSP responses were decoded as 'nil'.
This caused ambiguity for fields typed as '? | null' and led to
loss of explicit 'null' values, particularly in 'data' parameters.

Solution:
Decode all JSON 'null' values as 'vim.NIL' and adjust handling
where needed. This better aligns with the LSP specification,
where 'null' and absent fields are distinct, and 'null' should
not be used to represent missing values.

This also enables proper validation of response messages to
ensure that exactly one of 'result' or 'error' is present, as
required by the JSON-RPC specification.
2025-08-03 07:42:44 -07:00
bfredl
2ef48fc65c Merge pull request #35130 from bfredl/cringe
fix(options): make 'cdhome' take effect on any platform
2025-08-03 10:19:11 +02:00
bfredl
9910445125 fix(options): make 'cdhome' take effect on any platform
Platform specific options are cringe and should either be fixed or
deleted.

In this case, the platform difference can trivially be implemented
using a conditional default value. If the user overrides the value,
then it is because the user wants that value, regardless of the
corporation who manufactured the OS that the user is running.

Possible alternative: delete the option by making it always on.
2025-08-03 09:42:35 +02:00
Sathya Pramodh
78f4994627 feat: ":restart [cmd]" can run commands #35045
Problem:
Not easy for a user to tell ":restart" to "run this command(s) after restarting".

Solution:
All ":restart" args following the optional +cmd arg are treated as a big cmdline that is passed as a "-c" CLI arg when restarting nvim.
2025-08-02 22:50:45 -07:00
Justin M. Keyes
39e402caa5 docs: reorder sections #35140
Problem:
Generated docs sections are ordered randomly. This matters when showing
an outline or table of contents (e.g. `gO`).

Solution:
Specify which sections have an intentional ordering; sort the rest by
name.
2025-08-03 05:03:09 +00:00
zeertzjq
e23794b090 vim-patch:3add0d5: runtime(ccomplete): use complete_check() in ccomplete plugin (#35142)
Add complete_check() to ccomplete completion script to avoid UI hangs
and keep Vim responsive as ccomplete can be slow on huge files.

closes: vim/vim#17826

3add0d5e75

vim-patch:44309b9: runtime(ccomplete): return partial results on complete_check()

closes: vim/vim#17838

44309b9d08

Co-authored-by: Maxim Kim <habamax@gmail.com>
2025-08-03 11:49:13 +08:00
zeertzjq
f7af0cff35 vim-patch:9.1.1590: cannot perform autocompletion (#35141)
Problem:  cannot perform autocompletion
Solution: Add the 'autocomplete' option value
          (Girish Palya)

This change introduces the 'autocomplete' ('ac') boolean option to
enable automatic popup menu completion during insert mode. When enabled,
Vim shows a completion menu as you type, similar to pressing |i\_CTRL-N|
manually. The items are collected from sources defined in the
'complete' option.

To ensure responsiveness, this feature uses a time-sliced strategy:

- Sources earlier in the 'complete' list are given more time.
- If a source exceeds its allocated timeout, it is interrupted.
- The next source is then started with a reduced timeout (exponentially
  decayed).
- A small minimum ensures every source still gets a brief chance to
  contribute.

The feature is fully compatible with other |i_CTRL-X| completion modes,
which can temporarily suspend automatic completion when triggered.

See :help 'autocomplete' and :help ins-autocompletion for more details.

To try it out, use :set ac

You should see a popup menu appear automatically with suggestions. This
works seamlessly across:

- Large files (multi-gigabyte size)
- Massive codebases (:argadd thousands of .c or .h files)
- Large dictionaries via the `k` option
- Slow or blocking LSP servers or user-defined 'completefunc'

Despite potential slowness in sources, the menu remains fast,
responsive, and useful.

Compatibility: This mode is fully compatible with existing completion
methods. You can still invoke any CTRL-X based completion (e.g.,
CTRL-X CTRL-F for filenames) at any time (CTRL-X temporarily
suspends 'autocomplete'). To specifically use i_CTRL-N, dismiss the
current popup by pressing CTRL-E first.

---

How it works

To keep completion snappy under all conditions, autocompletion uses a
decaying time-sliced algorithm:

- Starts with an initial timeout (80ms).
- If a source does not complete within the timeout, it's interrupted and
  the timeout is halved for the next source.
- This continues recursively until a minimum timeout (5ms) is reached.
- All sources are given a chance, but slower ones are de-prioritized
  quickly.

Most of the time, matches are computed well within the initial window.

---

Implementation details

- Completion logic is mostly triggered in `edit.c` and handled in
  insexpand.c.

- Uses existing inc_compl_check_keys() mechanism, so no new polling
  hooks are needed.

- The completion system already checks for user input periodically; it
  now also checks for timer expiry.

---

Design notes

- The menu doesn't continuously update after it's shown to prevent
  visual distraction (due to resizing) and ensure the internal list
  stays synchronized with the displayed menu.

- The 'complete' option determines priority—sources listed earlier get
  more time.

- The exponential time-decay mechanism prevents indefinite collection,
  contributing to low CPU usage and a minimal memory footprint.

- Timeout values are intentionally not configurable—this system is
  optimized to "just work" out of the box. If autocompletion feels slow,
  it typically indicates a deeper performance bottleneck (e.g., a slow
  custom function not using `complete_check()`) rather than a
  configuration issue.

---

Performance

Based on testing, the total roundtrip time for completion is generally
under 200ms. For common usage, it often responds in under 50ms on an
average laptop, which falls within the "feels instantaneous" category
(sub-100ms) for perceived user experience.

| Upper Bound (ms) | Perceived UX
|----------------- |-------------
| <100 ms          | Excellent; instantaneous
| <200 ms          | Good; snappy
| >300 ms          | Noticeable lag
| >500 ms          | Sluggish/Broken

---

Why this belongs in core:

- Minimal and focused implementation, tightly integrated with existing
  Insert-mode completion logic.
- Zero reliance on autocommands and external scripting.
- Makes full use of Vim’s highly composable 'complete' infrastructure
  while avoiding the complexity of plugin-based solutions.
- Gives users C native autocompletion with excellent responsiveness and
  no configuration overhead.
- Adds a key UX functionality in a simple, performant, and Vim-like way.

closes: vim/vim#17812

af9a7a04f1

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-03 11:48:42 +08:00
Maria José Solano
26cc42e426 fix(lsp): handle nil response in references request #35139 2025-08-02 19:58:58 -07:00
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