Commit Graph

31936 Commits

Author SHA1 Message Date
zeertzjq
e2aca58bcc fix(lua): don't override script ID from :source (#32626)
Problem:  When setting an option, mapping etc. from Lua without -V1, the
          script ID is set to SID_LUA even if there already is a script
          ID assigned by :source.
Solution: Don't set script ID to SID_LUA if it is already a Lua script.
          Also add _editor.lua to ignorelist to make script context more
          useful when using vim.cmd().
2025-02-25 23:40:21 +00:00
luukvbaal
af0a2157ad fix(move): wrong cursor row on concealed line (#32629)
Problem:  Cursor row calculation does not take into account concealed lines.
Solution: Break the loop when the next calculated line is concealed.
2025-02-25 23:45:52 +01:00
Luuk van Baal
c3337e357a fix(treesitter): nil check query for has_conceal_line 2025-02-25 16:21:16 +01:00
zeertzjq
3bdc3a1689 test(ui/cursor_spec): reduce flakiness (#32627) 2025-02-25 21:29:10 +08:00
Luuk van Baal
47aaddfa0d fix(lsp): resize hover window for concealed lines
Problem:  Height of a (markdown) `vim.lsp.util.open_floating_preview()`
          window can be reduced to account for concealed lines (after #31324).
Solution: Set the window height to the text height of the preview window.
          Set 'concealcursor' to avoid unconcealing the cursorline when
          entering the hover window.
2025-02-25 14:26:58 +01:00
Luuk van Baal
8ba047e33f feat(treesitter): vertical conceal support for highlighter
TSHighlighter now places marks for conceal_lines metadata. A new
internal decor provider callback _on_conceal_line was added that
instructs the highlighter to place conceal_lines marks whenever the
editor needs to know whether a line is concealed. The bundled markdown
queries use conceal_lines metadata to conceal code block fence lines.
2025-02-25 13:09:01 +01:00
Luuk van Baal
f58e7d5fac feat(marks): add conceal_lines to nvim_buf_set_extmark()
Implement an extmark property that conceals lines vertically.
2025-02-25 13:09:01 +01:00
zeertzjq
a31ccc3b1f vim-patch:9.1.1140: filetype: m17ndb files are not detected (#32618)
Problem:  filetype: m17ndb files are not detected
Solution: detect m17ndb files as m17ndb filetype,
          include filetype, syntax and indent files for the
          new filetype (David Mandelberg).

References:

https://www.nongnu.org/m17n/manual-en/m17nDBFormat.html describes the
format. https://git.savannah.nongnu.org/cgit/m17n/m17n-db.git/tree/ has
examples of the files.

closes: vim/vim#16696

ed7d8e55ac

Also adjust the xkb parent pattern according to dev_vimpatch.txt.

Co-authored-by: David Mandelberg <david@mandelberg.org>
2025-02-25 09:20:44 +00:00
Artem
0c650da799 test: combined injections (#32611)
* refactor: rewrite test without trailing whitespace

* test: combined injection tests
2025-02-25 09:12:49 +00:00
glepnir
c9a2b16c48 vim-patch:9.1.1145: multi-line completion has wrong indentation for last line (#32625)
Problem:  When expanding omni completion items with newlines (e.g.
          `then\n\t\nend`), the end statement gets wrong indentation.
Solution: Add OPENLINE_FORCE_INDENT flag to make open_line() use
          second_line_indent directly (glepnir)

closes: vim/vim#16614

5090a1fecb
2025-02-25 06:30:21 +00:00
zeertzjq
095c0876c2 fix(api): don't override Vimscript SID (#32610)
Problem:  When calling an API from Vimscript to set an option, mapping,
          etc., :verbose shows that it's set from an API client.
Solution: Don't override current_sctx.sc_sid when calling an API from
          Vimscript. Also fix the inverse case where API channel id is
          not set when calling an API from RPC. Move channel id into
          sctx_T to make saving and restoring easier.

Related #8329
2025-02-25 01:17:51 +00:00
phanium
614c9322d5 fix(lua): SIGSEGV in luv callback with error(nil) #32595
Problem:
luv callback `vim.uv.new_timer():start(0, 0, function() error() end)`
causes SIGSEGV, since `xstrdup` gets NULL from `lua_tostring`.
Similar to: a5b1b83a26

Solution:
Check NULL before `xstrdup`.
2025-02-24 13:34:49 -08:00
zeertzjq
56fabcadb6 vim-patch:025dc48: runtime(vim): Update base-syntax, match :CompilerSet and :SynMenu commands (#32605)
closes: vim/vim#16713

025dc48e88

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-02-24 04:16:36 +00:00
zeertzjq
01236c3bfe vim-patch:9.1.1143: illegal memory access when putting a register (#32604)
Problem:  illegal memory access when putting a register
Solution: make sure cursor column doesn't become negative

e0029daa35

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-02-24 11:20:37 +08:00
Evgeni Chasnovski
268a3de0a7 feat(complete): CompleteDone reason "cancel", "discard" #32600
Problem: there is no way to distinguish between user's explicit
  completion stop/cancel and other automated reasons.

Solution: update "cancel" reason to be set only on explicit CTRL-e, and
  set intentionally vague "discard" otherwise.
2025-02-23 14:08:26 -08:00
Evgeni Chasnovski
07c5f41da3 fix(float): can set title/footer without setting border #32594
Problem: setting title and/or footer without explicitly setting border
  shows "title/footer/ requires border to be set" error.
  At the same time, explicitly setting `border = "none"` (which is
  default) shows expected no-border-no-title-no-footer window without
  error.

Solution: allow setting title/footer without explicitly setting border.
2025-02-23 09:08:16 -08:00
Yi Ming
6bc7979044 fix(lsp): reset the applied hints on refresh request #32446 2025-02-23 08:48:08 -08:00
Justin M. Keyes
2a733ec6cc revert "feat(ftplugin): set 'omnifunc' of Lua to 'v:lua.vim.lua_omnifunc'" #32597
This reverts commit f398e3a61a.
2025-02-23 08:21:24 -08:00
Justin M. Keyes
9304a417af Merge #32503 feat(lsp): use the meta model to generate server capability map 2025-02-23 08:20:19 -08:00
Riley Bruins
0c9c140f91 refactor(treesitter): simplify parsing coroutine logic
Lua coroutines can yield across non-coroutine function boundaries,
meaning that we don't need to wrap each helper function in a coroutine
and resume it within `_parse()`. If we just have them yield when
appropriate, this will be caught by the top level `_parse()` coroutine,
and resuming the `_parse()` will resume from the position in the helper
function where we yielded last.
2025-02-23 17:12:58 +01:00
Phạm Bình An
f398e3a61a feat(ftplugin): set Lua 'omnifunc' to vim.lua_omnifunc #32491
Problem:
- Many other ftplugin have defined 'omnifunc', but the Lua one doesn't
  define one, even though there is `vim.lua_omnifunc()`
- Users may want "stupid" completion to fix Lua config with
  `nvim --clean` in case they breaks it

Solution:
Set 'omnifunc' to 'v:lua.vim.lua_omnifunc' in ftplugin/lua.lua
2025-02-23 07:57:16 -08:00
Dan Sully
b283736388 fix(lua): @private => @nodoc #32587
Problem:
vim.log.levels.* and vim.opt_local are marked `@private` but they should be `@nodoc`.

Solution:
Fix the annotation.
2025-02-23 07:51:12 -08:00
dundargoc
4a0ee22e77 build: make makefile work on msys
Relying on $(OS) doesn't work as it's too naive, so we check if $PATH
contains a colon instead.

Closes https://github.com/neovim/neovim/issues/31027
2025-02-23 11:38:29 +01:00
Maria José Solano
d2cca606a1 fix(float): ensure floating window width can fit title 2025-02-23 10:32:20 +00:00
zeertzjq
f932c7852e Merge pull request #32593 from zeertzjq/vim-9.1.1139
vim-patch:9.1.{1139,1141}
2025-02-23 17:53:53 +08:00
zeertzjq
365b865d6b vim-patch:9.1.1141: Misplaced comment in readfile()
Problem:  Misplaced comment in readfile().
          (after v9.1.1139)
Solution: Move the comment above S_ISDIR().
          (zeertzjq)

closes: vim/vim#16714

b8989fb860
2025-02-23 17:19:55 +08:00
zeertzjq
0861ea6949 vim-patch:9.1.1139: [fifo] is not displayed when editing a fifo
Problem:  [fifo] is not displayed when editing a fifo
          (after v7.4.2189)
Solution: stat the filename and detect the type correctly

fixes: vim/vim#16702
closes: vim/vim#16705

f1c3134ee1

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-02-23 17:19:55 +08:00
zeertzjq
16e6f6e584 vim-patch:9.1.1137: ins_str() is inefficient by calling STRLEN() (#32591)
Problem:  ins_str() is inefficient by calling STRLLEN()
Solution: refactor ins_str() to take a length argument
          and let all callers provide the correct length
          when calling ins_str() (John Marriott)

closes: vim/vim#16711

f4b36417e8

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-02-23 16:52:44 +08:00
luukvbaal
5a41f7e69c vim-patch:9.1.1136: Match highlighting marks a buffer region as changed (#32561)
Problem:  Match highlighting marks a buffer region to be redrawn as if
          its buffer text was changed, unnecessarily invoking syntax code.
Solution: Set the `w_redraw_top/bot` variables instead of the b_mod_* ones
          (Luuk van Baal)

7bbb0f357e
2025-02-23 16:35:26 +08:00
James McCoy
1c81734871 test(unit/strings_spec): show ctx when vim_snprintf content check fails #32570
Same idea as a7be4b7bf8, but that only showed the context if the
length of the string differed. Since these tests check both string
length and string content, the ctx should be provided for both.

    ERROR    test/unit/testutil.lua @ 797: vim_snprintf() positional arguments
    test/unit/testutil.lua:769: test/unit/testutil.lua:753: (string) '
    test/unit/strings_spec.lua:159: snprintf(buf, 4, "%1$0.*2$b", 12ULL, cdata<int>: 0xf78c8ed8) = 001100
    Expected objects to be the same.
    Passed in:
    (string) '000'
    Expected:
    (string) '001''
2025-02-22 17:11:15 -08:00
Christian Clason
228fe50087 vim-patch:9.1.1134: filetype: Guile init file not recognized
Problem:  filetype: Guile init file not recognized
Solution: detect '.guile' file as scheme filetype
          (David Mandelberg)

References:

https://www.gnu.org/software/guile/manual/html_node/Init-File.html
> When run interactively, Guile will load a local initialization file
> from ~/.guile. This file should contain Scheme expressions for
> evaluation.

closes: vim/vim#16683

41a6026f00

Co-authored-by: David Mandelberg <david@mandelberg.org>
2025-02-23 00:19:53 +01:00
Christian Clason
010684e024 vim-patch:9.1.1133: filetype: xkb files not recognized everywhere
Problem:  filetype: xkb files not recognized everywhere
Solution: detect xkb files in more places
          (David Mandelberg)

References:
https://xkbcommon.org/doc/current/user-configuration.html#user-config-locations

closes: vim/vim#16684

b62bf81488

Co-authored-by: David Mandelberg <david@mandelberg.org>
2025-02-23 00:19:53 +01:00
Christian Clason
90958c3648 vim-patch:61af587: runtime(dockerfile): set comments in filetype plugin
closes: vim/vim#16698

61af587f26

Co-authored-by: David Mandelberg <david@mandelberg.org>
2025-02-22 16:17:11 +01:00
Christian Clason
5f11efe423 vim-patch:d15114c: runtime(compiler): include svelte-check compiler
closes: vim/vim#16704

d15114c148

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2025-02-22 16:17:11 +01:00
phanium
e641155b02 fix(runtime): avoid E31 in ftplugin (#32578)
fix: twice nunmap in ftplugin
2025-02-22 14:17:35 +01:00
Christian Clason
2e5b560482 feat(treesitter): table of contents for checkhealth, markdown (#32282)
Problem: It's difficult to navigate large structured text files (vim
help, checkhealth, Markdown).

Solution: Support `gO` for table of contents and `]]`/`[[` for moving
between headings for all these filetypes using treesitter queries.

Refactor: colorization of highlight groups is moved to the `help` ftplugin
while headings-related functionality is implemented in a private
`vim.treesitter` module for possible future use for other filetypes.
2025-02-22 13:07:21 +01:00
zeertzjq
5cead869fb vim-patch:9.1.1135: 'suffixesadd' doesn't work with multiple items (#32573)
Problem:  'suffixesadd' doesn't work with multiple items
          (after 9.1.1122).
Solution: Don't concat multiple suffixes together.
          (zeertzjq)

fixes: vim/vim#16694
closes: vim/vim#16699

bf595ae4ac
2025-02-22 08:38:12 +00:00
Mathias Fussenegger
8d7eb03040 fix(lsp): unify get_completion_word for textEdits/insertText
Problem:

After https://github.com/neovim/neovim/pull/32377 selecting snippets
provided by luals inserted the multi-line text before accepting the
candidates. That's inconsistent with servers who provide `textEdit`
instead of `insertText` and having lines shift up/down while cycling
through the completion candidates is a bit irritating.

Solution:

Use the logic used for `textEdit` snippets also for `insertText`
2025-02-22 09:33:54 +01:00
Sören Tempel
db2c3d1143 fix(tests): filter out lines with __typeof__ keyword (#32524)
Problem: On 32-bit architectures, musl libc makes heavy use of
__typeof__ as part of its __REDIR macro for optional backwards
compatibility with 32-bit time_t values. Unfortunately, the
__typeof__ keyword is not supported by the LuaJIT C parser.

Solution: Filter out the keyword in filter_complex_blocks.
2025-02-22 07:37:15 +08:00
zeertzjq
59b672fda2 vim-patch:9.1.1132: Mark positions wrong after triggering multiline completion (#32564)
Problem:  Mark positions wrong after triggering multiline completion.
Solution: Call deleted_lines_mark() after deleting lines.
          (zeertzjq)

closes: vim/vim#16687

060e6556e2

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2025-02-21 23:07:47 +00:00
zeertzjq
f3f94d2c37 vim-patch:partial:9.1.1131: potential out-of-memory issue in search.c (#32565)
Problem:  potential out-of-memory issue in search.c
Solution: improve situation and refactor search.c slightly
          (John Marriott)

- In function update_search_stat():
  add a check for a theoretical null pointer reference, set and remember
  the length of lastpat, remove the three calls to STRLEN() and use the
  various string's associated lengths instead, add a check for an
  out-of-memory condition.

- In function search_for_fuzz_match():
  remove a call to strnsave() and thus avoid having to add a check for
  an out-of-memory condition, also replace the call to STRLEN() by
  ml_get_buf_len().

closes: vim/vim#16689

b79fa3d9c8

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-02-21 22:49:59 +00:00
zeertzjq
cdedfc3743 fix(marks): truncate double-width inline virt_text consistently (#32560)
- Fix wrong cursor position with 'listchars' "precedes".
- Always show the '<' truncation character.
2025-02-21 22:35:10 +00:00
zeertzjq
4ff813e5c6 vim-patch:9.1.1130: 'listchars' "precedes" is not drawn on Tabs. (#32563)
Problem:  'listchars' "precedes" is not drawn on Tabs.
Solution: Only draw 'listchars' "precedes" when not skipping over cells.
          (zeertzjq)

fixes: vim/vim#5927
closes: vim/vim#16691

13f100e932
2025-02-21 22:05:32 +00:00
Riley Bruins
cbad2c6628 perf(treesitter): don't block when finding injection ranges
**Problem:** Currently, parsing is asynchronous, but it involves a
(sometimes lengthy) step which finds all injection ranges for a tree by
iterating over that language's injection queries. This causes edits in
large files to be extremely slow, and also causes a long stutter during
the initial parse of a large file.

**Solution:** Break up the injection query iteration over multiple event
loop iterations.
2025-02-21 18:10:24 +01:00
Maria José Solano
e4c1f6667b feat(lsp): use the meta model to generate server capability map 2025-02-21 08:40:33 -08:00
zeertzjq
2e0a563828 test: adjust multibyte virtual text test (#32557)
Having more chars after a double-width char makes it easier to spot the
bug where truncating it causes the pending chars to be lost.
2025-02-21 20:57:41 +08:00
Riley Bruins
55b165ac15 fix(treesitter): TSNode:field() returns all children with the given field 2025-02-21 09:47:02 +00:00
Christian Clason
3e39250a79 vim-patch:3cb4148: runtime(sieve): set fileformat=dos in filetype plugin
References:
https://datatracker.ietf.org/doc/html/rfc5228#section-2.2

closes: vim/vim#16685

3cb41489dc

Co-authored-by: David Mandelberg <david@mandelberg.org>
2025-02-21 10:03:52 +01:00
Christian Clason
2b7d9d1900 vim-patch:27f5136: runtime(mail): add commentstring '> %s' to ftplugin
The new native commenting functionality is currently not used when
editing mail. One could reasonably expect it to change the "quote" state
of any given line in the mail (i.e. the preceding ">"), which would be
very handy and feel natural when editing mail. Especially since the
current file already uses "setlocal comments+=n:>".

Solution: Add commentstring to `> %s` to be used in files of type mail.

closes: vim/vim#16669

27f5136761

Co-authored-by: Lucas Eekhof <105216949+eekhof@users.noreply.github.com>
2025-02-21 10:03:52 +01:00
Christian Clason
40dfc4ebd1 vim-patch:106899e: runtime(dnsmasq): include simple filetype plugin
closes: vim/vim#16671

106899eb21

Co-authored-by: dringsim <dringsim@qq.com>
2025-02-21 10:03:52 +01:00