Commit Graph

33580 Commits

Author SHA1 Message Date
ite-usagi
ddae46fba0 docs(l10n): building translation file #35380 2025-08-18 08:06:21 -07:00
Justin M. Keyes
1b2a6e0664 Merge #35018 refactor(lsp): centralized enable/is_enabled strategy 2025-08-18 10:57:57 -04:00
Yi Ming
f40162ba19 refactor(lsp): use vim.lsp._capability.enable internally 2025-08-18 19:41:55 +08:00
Yi Ming
050b04384e refactor(lsp): correct enable marker name 2025-08-18 19:41:55 +08:00
Yi Ming
2ace4089f8 refactor(lsp): no longer rely on LspDetach for detaching capabilities 2025-08-18 19:41:55 +08:00
Yi Ming
b3fbc8d6fa refactor(lsp): move util.enable to capability.enable 2025-08-18 19:41:53 +08:00
zeertzjq
052126b77a test(tui_spec): avoid race between server exit and new client (#35376)
Don't start a new client to check for server exit. Check for the server
socket being removed instead.
2025-08-18 15:24:22 +08:00
zeertzjq
f363ea8547 test(tui_spec): fix another case of flakiness (#35374) 2025-08-18 12:53:40 +08:00
Justin M. Keyes
960b33a9d8 docs: misc, dev-api-fast, $XDG_STATE_HOME #35138 2025-08-17 20:45:40 -07:00
Siddhant Agarwal
1d40f67776 feat(ssh): SSH configuration parser #35027 2025-08-17 20:40:28 -07:00
zeertzjq
37119ad0d2 vim-patch:9.1.1645: fuzzy.c can be further improved (#35371)
Problem:  fuzzy.c can be further improved
Solution: Fix memory leak and refactor it (glepnir).

Optimize performance and memory allocation:

- Fix memory leak in fuzzy_match_in_list.
- using single memory allocation in match_positions
- Improve has_match performance and add null pointer checks

closes: vim/vim#18012

59799f3afa

Co-authored-by: glepnir <glephunter@gmail.com>
2025-08-18 11:03:08 +08:00
zeertzjq
e4d3812c8b Merge pull request #35370 from zeertzjq/excmd
:connect fixes
2025-08-18 09:43:34 +08:00
zeertzjq
c1f142322b fix(excmd): correct :connect abbreviation 2025-08-18 09:22:42 +08:00
zeertzjq
f5cbf11644 fix(client): avoid :connect race with server detach
Also fix some warnings and flakiness in :restart/:connect tests.
2025-08-18 09:22:41 +08:00
Sean Dewar
2211953266 fix(api): on_detach consistently before buf_freeall autocmds
Problem: on_detach may be called after buf_freeall and other important things,
plus its textlock restrictions are insufficient. This can cause issues such as
leaks, internal errors and crashes.

Solution: disable buffer updates in buf_freeall, before autocommands (like the
order after #35355 and when do_ecmd reloads a buffer). Don't do so in
free_buffer_stuff; it's not safe to run user code there, and buf_freeall already
runs before then; just free them to avoid leaks if buf_freeall autocommands
registered more for some reason.

Fixes #28084
Fixes #33967
Fixes #35116
2025-08-17 22:32:53 +01:00
Justin M. Keyes
d8ed43c6a7 Merge #35109 vim.pos, vim.range 2025-08-17 16:37:56 -04:00
Corey Cole
4299837b44 docs(windows): WSL build instructions #35365 2025-08-17 13:07:03 -07:00
Justin M. Keyes
7eb9badd93 refactor(tests): remove redundant test #35364 2025-08-17 12:11:13 -07:00
Jaehwang Jung
285c04e2d0 fix(api,lsp): call on_detach before wiping out the buffer #35355
Problem:
Buffer-updates on_detach callback is invoked before buf_freeall(), which
deletes autocmds of the buffer (via apply_autocmds(EVENT_BUFWIPEOUT,
...)). Due to this, buffer-local autocmds executed in on_detach (e.g.,
LspDetach) are not actually invoked.

Solution:
Call buf_updates_unload() before buf_freeall().
2025-08-17 11:37:24 -07:00
zeertzjq
35a7642647 vim-patch:3cee950: runtime(diff): fix mixed translations in zh_CN (#35362)
some translations confused zh_CN and zh_TW

3cee950fc9

Co-authored-by: 毛逸宁 <mao.yining@outlook.com>
2025-08-17 18:33:29 +08:00
Yi Ming
a37e101dc7 refactor(lsp): change capability name to snake case 2025-08-17 12:37:34 +08:00
Yi Ming
7c3e579a90 refactor(lsp): register all derived Capability prototypes 2025-08-17 12:37:34 +08:00
Yi Ming
81d8198bda refactor(lsp): define Capability.on_attach 2025-08-17 12:37:34 +08:00
Yi Ming
a7fef170b7 refactor(lsp): check supported methods instead of tbl_get 2025-08-17 12:37:34 +08:00
Yi Ming
9f5b309d82 feat(lua): conversion between vim and lsp position/range 2025-08-17 12:13:24 +08:00
Yi Ming
98f8224c19 feat(lua): vim.pos/vim.range 2025-08-17 11:54:53 +08:00
zeertzjq
7e450aa383 vim-patch:b405c79: runtime(vim): set 'comments' based on script type (legacy/Vim9) (#35359)
fixes: vim/vim#18000

b405c79004

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-08-17 01:26:37 +00:00
zeertzjq
577f9fa1be vim-patch:9.1.1640: Unicode has deprecated some code-points (#35358)
Problem:  Unicode has deprecated some code-points
Solution: Update the digraph tables to align with the Unicode v16
          release (David Friant)

This commit updates the digraphs Left-Pointing Angle Bracket '</'
and Right-Pointing Angle Bracket '/>' to account for the fact that
the old Unicode codepoints for them (2329 and 232A, respectively)
have been deprecated. As per the Miscellaneous Technical code chart
(https://www.unicode.org/charts/PDF/U2300.pdf), the old digraphs
have been reassigned to the CJK Left Angle Bracket and Right Angle
Bracket (3008 and 3009) with their declaration moved to the
appropriate block.

This commit also introduces the new digraphs '<[' and ']>' to
represent the Mathematical Left Angle Bracket and Mathematical
Right Angle Bracket (27E8 and 27E9) to replace the deprecated code
points in the Technical block.

Tests have been added and, I believe, the documentation has been
updated accordingly.

closes: vim/vim#17990

c08b94b072

Co-authored-by: David Friant <friant@HPEnvyx360.friant.dev>
2025-08-17 08:52:05 +08:00
Michael Henry
5f8d4a248a feat(provider): detect venv python via "pynvim-python" tool #35273
Problem:
Detection of the pynvim module is currently done by finding the first
Python interpreter in the `PATH` and checking if it can import pynvim.
This has several problems:
- Activation of an unrelated Python virtual environment will break
  automatic detection, unless pynvim is also installed in that
  environment.
- Installing pynvim to the expected location is difficult. User
  installation into the system-wide or user-wide Python site area is now
  deprecated.  On Ubuntu 24.04 with Python 3.12, for example, the
  command `pip install --user pynvim` now fails with the error message
  `error: externally-managed-environment`.
- Users may create a dedicated virtual environment in which to install
  pynvim, but Nvim won't detect it; instead, they must either activate
  it before launching Nvim (which interferes with the user of other
  virtual environments) or else hard-code the variable
  `g:python3_host_prog` in their `init.vim` to the path of the correct
  Python interpreter.  Neither option is desirable.

Solution:
Expose pynvim's Python interpreter on the `PATH` under the
name `pynvim-python`.  Typical user-flow:

1. User installs either uv or pipx.
2. User installs pynvim via:
   ```
   uv tool install --upgrade pynvim
   # Or:
   pipx install --upgrade pynvim
   ```

With corresponding changes in pynvim https://github.com/neovim/pynvim/issues/593
the above user-flow is all that's needed for Nvim to detect the
installed location of pynvim, even if an unrelated Python virtual
environments is activated.  It uses standard Python tooling to automate
the necessary creation of a Python virtual environment for pyenv and the
publication of `pynvim-python` to a directory on `PATH`.
2025-08-16 14:48:08 -07:00
MinimalEffort07
77860f5418 build(deps): CMake generation fails when path contains spaces #35332
Problem:
Additional include directories in DEPS_INCLUDE_FLAGS variable are not
quoted. Paths with spaces break the resulting compile command.

Solution:
Enclose values in double quotes.
Note: normally we should avoid manual quoting, but in this case we can't
because of how `DEPS_INCLUDE_FLAGS` is used in `BuildLuv.cmake`
and `BuildLpeg.cmake`.
2025-08-16 12:25:34 -07:00
zeertzjq
013af17ed9 vim-patch:9.1.1623: Buffer menu does not handle unicode names correctly (#35353)
Problem:  Buffer menu does not handle unicode names correctly
          (after v9.1.1622)
Solution: Fix the BMHash() function (Yee Cheng Chin)

The Buffers menu uses a BMHash() function to generate a sortable number
to be used for the menu index. It used a naive (and incorrect) way of
encoding multiple ASCII values into a single integer, but assumes each
character to be only in the ASCII 32-96 range. This means if we use
non-ASCII file names (e.g. Unicode values like CJK or emojis) we get
integer underflow and overflow, causing the menu index to wrap around.
Vim's GUI implementations internally use a signed 32-bit integer for the
`gui_mch_add_menu_item()` function and so we need to make sure the menu
index is in the (0, 2^31-1) range.

To do this, if the file name starts with a non-ASCII value, we just use
the first character's value and set the high bit so it sorts after the
other ASCII ones. Otherwise, we just take the first 5 characters, and
use 5 bit for each character to encode a 30-bit number that can be
sorted.

This means Unicode file names won't be sorted beyond the first
character. This is likely going to be fine as there are lots of ways to
query buffers.

related: vim/vim#17403
closes: vim/vim#17928

8f9de4991e

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-08-16 13:20:36 +08:00
bfredl
c12701d4e1 Merge pull request #35329 from bfredl/uncrustify_all
fix(build): also check os_win sources with uncrustify in CI
2025-08-15 11:06:42 +02:00
zeertzjq
8d154e5927 vim-patch:9.1.1633: Search pattern shown incorrectly with negative offset (#35337)
Problem:  Search pattern shown incorrectly with negative offset.
          (lkintact)
Solution: Don't prepend a '+' sign to a negative offset (zeertzjq).

fixes: vim/vim#17993
closes: vim/vim#17994

ade0815856
2025-08-15 00:06:32 +00:00
zeertzjq
7afcfb6c9a vim-patch:9.1.1632: memory leak in fuzzy.c
Problem:  memory leak in fuzzy.c
Solution: Free fuzmatch, add a few minor refactors
          (glepnir)

fixes neovim CID 584055: fuzmatch leak when count becomes 0
Fix partial allocation failure cleanup in buffer expansion

closes: vim/vim#17996

03d6e06edd

Co-authored-by: glepnir <glephunter@gmail.com>
2025-08-15 07:17:24 +08:00
zeertzjq
e38e65b86c vim-patch:9.1.1630: tests: fuzzy bufname completion test doesn't match successfully
Problem:  tests: fuzzy buffer name completion test doesn't match
          successfully (after 9.1.1627).
Solution: Update pattern to account for the change in case sensitivity.
          Also mark Test_search_stat_option() as flaky as it can still
          sometimes fail (zeertzjq).

closes: vim/vim#17992

891353671a
2025-08-15 07:17:24 +08:00
Gregory Anders
218ff601c4 fix(tui): do not emit resize screen sequence after host terminal is resized (#35335)
Some terminals support the CSI 8 t sequence to resize their own window
area. Neovim will emit this sequence when the TUI is resized
programatically, but it should not be emitted when the TUI is resized
because the host terminal was resized, as that results in an infinite
resize loop.
2025-08-14 18:14:26 -05:00
Siddhant Agarwal
649bb372f6 feat(ui): :connect command #34586
Add the `:connect <address>` command which connects the currently
running TUI to the server at the given address.
2025-08-14 15:58:09 -07:00
Jalil David Salamé Messina
bd45e2be63 fix(checkhealth): wrong ABI version for treesitter parsers #35327
Don't print ABI version of duplicated parsers that are later in the
runtime path (see [#35326]).

Change the sorting from `name > path` to `name > rtpath_index`, this
ensures the first (loaded) parser is first in the list and any
subsequent parsers can be considered "not loaded".

This is fuzzy at best since `vim.treesitter.language.add` can take a
path to a parser and change the load order.

The correct solution is for `vim.treesitter.language.inspect` to return
the parser path so we can compare against it and/or for it to also be
able to take a path to a parser so we can inspect it without loading it
first.
2025-08-14 11:47:43 -07:00
bfredl
c26f989b2f fix(build): also check os_win sources with uncrustify in CI 2025-08-14 10:36:08 +02:00
bfredl
38986188ba Merge pull request #35206 from bfredl/nopreproc_cleanup
refactor(build): remove INCLUDE_GENERATED_DECLARATIONS guards
2025-08-14 10:02:57 +02:00
bfredl
442f297c63 refactor(build): remove INCLUDE_GENERATED_DECLARATIONS guards
These are not needed after #35129 but making uncrustify still play nice
with them was a bit tricky.

Unfortunately `uncrustify --update-config-with-doc` breaks strings
with backslashes. This issue has been reported upstream,
and in the meanwhile auto-update on every single run has been disabled.
2025-08-14 09:34:38 +02:00
zeertzjq
d19d2b4491 vim-patch:1ee1d9b: runtime(python): highlight "self" and "cls" in syntax script (#35328)
These are special names by convention, and giving them distinct
highlighting is a nice visual clue (using Identifier by default).

This group is named "pythonClassVar" to match the name used by
python-syntax. Some third-party color schemes are aware of this
name and customized their colors accordingly.

closes: vim/vim#17968

1ee1d9b43d

Co-authored-by: Jon Parise <jon@indelible.org>
2025-08-14 08:36:24 +08:00
zeertzjq
9843573a61 Merge pull request #35320 from zeertzjq/vim-9.1.1627
vim-patch:9.1.{1627,1628}
2025-08-14 07:18:05 +08:00
zeertzjq
2619a749a5 vim-patch:9.1.1628: fuzzy.c has a few issues
Problem:  fuzzy.c has a few issues
Solution: Use Vims memory management, update style
          (glepnir)

Problem:
- Missing cleanup of lmatchpos lists causing memory leaks
- Missing error handling for list operations
- Use of malloc() instead of Vim's alloc() functions
- Inconsistent C-style comments
- Missing null pointer checks for memory allocation
- Incorrect use of vim_free() for list objects

Solution:
- Add proper cleanup of lmatchpos in done section using list_free()
- Set lmatchpos to NULL after successful transfer to avoid confusion
- Add error handling for list_append_tv() failures
- Replace malloc() with alloc() and add null pointer checks
- Convert C-style comments to C++ style for consistency
- Fix vim_free() calls to use list_free() for list objects

closes: vim/vim#17984

17a6d696bd

Co-authored-by: glepnir <glephunter@gmail.com>
2025-08-14 06:48:31 +08:00
zeertzjq
6f0ef8a5f2 vim-patch:c93a2b3: runtime(doc): Adapt fuzzy doc to reflect 'fzy' algorithm
closes: vim/vim#17988

c93a2b3327

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-14 06:48:31 +08:00
zeertzjq
869000e7ce vim-patch:9.1.1627: fuzzy matching can be improved
Problem:  fuzzy-matching can be improved
Solution: Implement a better fuzzy matching algorithm
          (Girish Palya)

Replace fuzzy matching algorithm with improved fzy-based implementation

The
[current](https://www.forrestthewoods.com/blog/reverse_engineering_sublime_texts_fuzzy_match/)
fuzzy matching algorithm has several accuracy issues:

* It struggles with CamelCase
* It fails to prioritize matches at the beginning of strings, often
  ranking middle matches higher.

After evaluating alternatives (see my comments
[here](https://github.com/vim/vim/issues/17531#issuecomment-3112046897)
and
[here](https://github.com/vim/vim/issues/17531#issuecomment-3121593900)),
I chose to adopt the [fzy](https://github.com/jhawthorn/fzy) algorithm,
which:

* Resolves the aforementioned issues.
* Performs better.

Implementation details

This version is based on the original fzy
[algorithm](https://github.com/jhawthorn/fzy/blob/master/src/match.c),
with one key enhancement: **multibyte character support**.

* The original implementation supports only ASCII.
* This patch replaces ascii lookup tables with function calls, making it
  compatible with multibyte character sets.
* Core logic (`match_row()` and `match_positions()`) remains faithful to
  the original, but now operates on codepoints rather than single-byte
  characters.

Performance

Tested against a dataset of **90,000 Linux kernel filenames**. Results
(in milliseconds) show a **\~2x performance improvement** over the
current fuzzy matching algorithm.

```
Search String            Current Algo    FZY Algo
-------------------------------------------------
init                          131.759    66.916
main                          83.688     40.861
sig                           98.348     39.699
index                         109.222    30.738
ab                            72.222     44.357
cd                            83.036     54.739
a                             58.94      62.242
b                             43.612     43.442
c                             64.39      67.442
k                             40.585     36.371
z                             34.708     22.781
w                             38.033     30.109
cpa                           82.596     38.116
arz                           84.251     23.964
zzzz                          35.823     22.75
dimag                         110.686    29.646
xa                            43.188     29.199
nha                           73.953     31.001
nedax                         94.775     29.568
dbue                          79.846     25.902
fp                            46.826     31.641
tr                            90.951     55.883
kw                            38.875     23.194
rp                            101.575    55.775
kkkkkkkkkkkkkkkkkkkkkkkkkkkkk 48.519     30.921
```

```vim
vim9script

var haystack = readfile('/Users/gp/linux.files')

var needles = ['init', 'main', 'sig', 'index', 'ab', 'cd', 'a', 'b',
'c', 'k',
    'z', 'w', 'cpa', 'arz', 'zzzz', 'dimag', 'xa', 'nha', 'nedax',
'dbue',
    'fp', 'tr', 'kw', 'rp', 'kkkkkkkkkkkkkkkkkkkkkkkkkkkkk']
for needle in needles
    var start = reltime()
    var tmp = matchfuzzy(haystack, needle)
    echom $'{needle}' (start->reltime()->reltimefloat() * 1000)
endfor
```

Additional changes

* Removed the "camelcase" option from both matchfuzzy() and
  matchfuzzypos(), as it's now obsolete with the improved algorithm.

related: neovim/neovim#34101
fixes vim/vim#17531
closes: vim/vim#17900

7e0df5eee9

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-14 06:48:30 +08:00
TheBlob42
6f904cfef1 fix(snippet): adjacent tabstops without placeholders (#35167)
* fix(snippet): adjacent tabstops without placeholders

* test(snippet): add tests for directly adjacent tabstops
2025-08-13 14:51:43 -04:00
zeertzjq
7b9512e613 fix(api): fix not capturing output in cmdline mode (#35322) 2025-08-13 20:12:47 +08:00
bfredl
44fdbd6589 Merge pull request #34969 from bfredl/winbuild
feat(build): build.zig windows support.
2025-08-13 10:23:18 +02:00
bfredl
b70a6f3f3e Merge pull request #34394 from bfredl/shadamem
refactor(shada): A shada entry is a shada entry
2025-08-13 10:19:25 +02:00