Commit Graph

30788 Commits

Author SHA1 Message Date
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
2377443cd2
vim-patch:9.1.0764: [security]: use-after-free when closing a buffer (#30705)
Problem:  [security]: use-after-free when closing a buffer
Solution: When splitting the window and editing a new buffer,
          check whether the newly to be edited buffer has been marked
          for deletion and abort in this case

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-rj48-v4mq-j4vg

51b62387be

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-10-07 10:40:44 +08: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
40ec3d7bc0
vim-patch:9.1.0761: :cd completion fails on Windows with backslash in path (#30703)
Problem:  :cd completion fails on Windows with backslash in path
Solution: switch no_bslash argument to FALSE in file_pat_to_reg_pat()

Note: only fixes the problem on Windows. For Unix, we still need to
escape backslashes since those are taken as regex atoms (and could be
invalid regex atoms).

fixes: vim/vim#15643
closes: vim/vim#15808

1a31c430bb

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-10-07 10:16:47 +08: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
Gregory Anders
5da2a171f7
docs: LspAttach, LspDetach examples #30661
The current LspAttach example shows setting options which are already
set by default. We should expect that users are going to copy-paste
these examples, so we shouldn't use examples that are superfluous and
unnecessary.
2024-10-06 11:53:29 -07:00
Justin M. Keyes
6628741ada
feat(docs): improve @see meta docstrings #30693 2024-10-06 09:12:35 -07:00
dundargoc
00d1078ede ci: bump macos runner version to macos-15 2024-10-06 16:06:28 +02: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
Devon Gardner
a2008118a0
fix(coverity/510436): shada_read_when_writing index out of bounds (#30686)
Problem:
Index for global and numbered marks out of bounds when indexing into
numbered marks array (contains 10 elements but indexed by values 26 through 35.

Solution:
Offset index by number of global marks to correctly index numbered marks array.
2024-10-06 11:21:26 +08:00
zeertzjq
dabd7ef906
Merge pull request #30684 from zeertzjq/vim-738ebfe
vim-patch: doc updates
2024-10-06 08:02:30 +08:00
zeertzjq
bd56c1e41f vim-patch:partial:89872f5: runtime(doc): update formatting and syntax
closes: vim/vim#15800

89872f58a9

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-06 07:44:40 +08:00
zeertzjq
dc704160b1 vim-patch:partial:738ebfe: runtime(doc): Fix style in documents
closes: vim/vim#15801

738ebfea41

Co-authored-by: h-east <h.east.727@gmail.com>
2024-10-06 07:44:34 +08:00
zeertzjq
a4ebea18f1
vim-patch:9.1.0003: Cannot build against Ruby 33 dynamically (#30683)
Problem:  Cannot build against Ruby 33 dynamically
Solution: Ruby 33 removed transient heap, so do not use
          rb_ary_transient anymore, NoMethodError format changed,
          so update test for expected error message
          (Isao Sato)

- ruby-3.3 removed transient heap for ruby/dyn

when +ruby/dyn with ruby-3.3 do command :ruby, E448 occur.
ruby-3.3 has no transient heap anymore, so disable rb_ary_transient etc.

$ LC_ALL=C VIMRUNTIME=runtime ./src/vim -u NONE -c 'ruby puts RUBY_VERSION'
"=> Error detected while processing command line:
"=> E448: Could not load library function rb_ary_detransient
"=> E266: Sorry, this command is disabled, the Ruby library could not be
    loaded.

- ruby-3.3 changed NoMethodError format:

$ rvm 3.2.2, 3.3.0-rc1 do ruby -e 'begin; nil.name; rescue => e; puts "%s : %s"%[RUBY_VERSION, e.message]; end '
=> 3.2.2 : undefined method `name' for nil:NilClass
=> 3.3.0 : undefined method `name' for nil

so loose pattern in Test_ruby_Vim_buffer_get()

closes: vim/vim#13741

443657b32b

Co-authored-by: Isao Sato <svardew@gmail.com>
2024-10-05 23:28:28 +00:00
zeertzjq
9f26bdc416
vim-patch:9.1.0759: screenpos() may return invalid position (#30681)
Problem:  screenpos() may return invalid position
          after switching buffers (Greg Hurrell)
Solution: reset w_leftcol if wrapping has been set
          after copying wrap option

fixes: vim/vim#15792
closes: vim/vim#15803

b065a10e24

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-10-06 06:49:23 +08:00
Justin M. Keyes
8801b77ed0
fix(docs): missing @returns desc in _meta/api.lua #30673 2024-10-05 08:52:57 -07:00
dundargoc
0c9b3ef34d ci: bump ubuntu runner version to ubuntu-24.04
Also bump clang to version 20.
2024-10-05 17:35:41 +02:00
Devon Gardner
ff7832ad3f
fix(coverity/497355): shada_read_when_writing out of bounds read #30665
Problem:
There appears to be an intentional array out of bounds read when
indexing global and numbered marks since they are adjacent in the struct
that holds them.

Solution:
Explicitly index numeric marks array to avoid reading out of bounds from
global marks array.
2024-10-05 07:18:00 -07:00
Christian Clason
988482d942 vim-patch:60310a4: runtime(java): Manage circularity for every :syn-included syntax file
With "g:markdown_fenced_languages" defined and "java" added
to its list, a circular dependency between the Markdown and
Java syntax files will be made.  To break it, no Markdown
documentation comments will be recognised in fenced blocks
in Markdown files; in order to view Java source files,
"java" must be removed from "g:markdown_fenced_languages",
and this task can be automated as follows.

1) Add to "~/.after/ftplugin/java.vim":
------------------------------------------------------------
if exists("g:markdown_fenced_languages") &&
	\ !(exists("g:java_ignore_javadoc") ||
	\ exists("g:java_ignore_markdown"))
    let s:idx = index(g:markdown_fenced_languages, 'java')
    if s:idx > -1
	call remove(g:markdown_fenced_languages, s:idx)
    endif
    unlet s:idx
endif
------------------------------------------------------------

2) Optionally add to "~/.after/ftplugin/markdown.vim":
------------------------------------------------------------
if exists("g:markdown_fenced_languages") &&
	\ index(g:markdown_fenced_languages, 'java') < 0
    call add(g:markdown_fenced_languages, 'java')
endif
------------------------------------------------------------

(Make sure that the above snippets appear in the files under
the "ftplugin" NOT "syntax" directory.)

Finally, unless the new version of the syntax file is made
available from "$VIMRUNTIME" (and from "~/.vim/syntax" if
necessary), OTHER discoverable file versions will be used
whose behaviour may interfere with this fix.

related: vim/vim#15740
closes: vim/vim#15796

60310a4b26

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2024-10-05 11:27:05 +02:00
zeertzjq
ab98c5b5a0
vim-patch:9.1.0758: it's possible to set an invalid key to 'wildcharm' (#30662)
Problem:  it's possible to set an invalid key to 'wildcharm'
Solution: error out, if the 'wildcharm' value is an invalid key
          (Milly)

closes: vim/vim#15787

40c6babc17

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-05 07:20:38 +08: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
Christian Clason
49b1af4e24 build(deps): bump tree-sitter to v0.24.1 2024-10-04 16:47:09 +02: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
zeertzjq
86c5c8724b
fix(mouse): indicate X1 and X2 button clicks on statusline (#30655) 2024-10-04 21:31:28 +08: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
Lewis Russell
c6abc97006 perf(treesitter): do not use tree cursors with a small lifetime
Problem:
Tree cursors can only be efficient when they are re-used.
Short-lived cursors are very slow.

Solution:
Reimplement functions that use short-lived cursors.
2024-10-03 11:19:59 +01:00
glepnir
cc300e553b
vim-patch:9.1.0756: missing change from patch v9.1.0754 (#30636)
Problem:  missing change from patch v9.1.0754
Solution: use correct width for the actual item
          in pum_redraw() (glepnir)

closes: vim/vim#15786

a6d9e3c4e0
2024-10-03 09:58:15 +00:00
zeertzjq
ae0e4071a8
vim-patch:9.1.0755: quickfix list does not handle hardlinks well (#30637)
Problem:  quickfix list does not handle hardlinks well
Solution: store original file name with quickfix entry
          (Austin Chang)

Quickfix list shows entries with duplicate name if the file is opened
with the path of hard links.

The major cause is that qflist assumed that the filename passed into
`qf_add_entry` matches the filename opened with the buffer.

This patch handles this case by introduce a `qf_fname` into `qfline_S`
structure. It stores the filename from `qf_add_entry` for each quickfix
line.

closes: vim/vim#15687

2982299699

Co-authored-by: Austin Chang <austin880625@gmail.com>
2024-10-03 09:44:04 +00:00
fredizzimo
7eba016c86
fix(ui): ensure screen update before waiting for input #30576
Ensure the screen is fully updated before blocking for input. This did
not always happen before, for example when setting `cursorline
scrolloff=9999`, which lead to jerky movement when using some GUI
applications.

Because of the duality of redraw_later, this can't be done in
command-line or when waiting for "Press ENTER". In many of those cases
the redraw is expected AFTER the key press, while normally it should
update the screen immediately. So, those special cases are excluded.
2024-10-03 02:31:17 -07:00
Christian Clason
b973789115 vim-patch:f416a22: runtime(systemd): small fixes to &keywordprg in ftplugin
closes: vim/vim#15784

f416a2220f

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2024-10-03 10:45:21 +02:00
zeertzjq
4075e613b2
fix(defaults): properly pass count to quickfix commands (#30632) 2024-10-03 10:57:54 +08:00
zeertzjq
184d5e7543
refactor: fix incorrect use of enum (#30631) 2024-10-03 10:34:55 +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
d3b4772ddc
Merge #30595 from justinmk/fixwatch 2024-10-02 08:05:03 -07:00
Justin M. Keyes
bbf208784c tests: skip watch.watchdirs test on macos 14 CI
Problem:
Strange failure only in macos 14 CI

    FAILED   test/functional/lua/watch_spec.lua @ 82: vim._watch watchdirs() detects file changes
    test/functional/lua/watch_spec.lua:149: Expected objects to be the same.
    Passed in:
    (table: 0x0116023758) {
     *[1] = {
        [change_type] = 3
       *[path] = '/Users/runner/work/neovim/neovim/build/Xtest_tmpdir/nvim_KFMvPbXk9a/nvim_KFMvPbXk9a' }
      [2] = {
        [change_type] = 3
        [path] = '/Users/runner/work/neovim/neovim/build/Xtest_tmpdir/nvim_KFMvPbXk9a/file' } }
    Expected:
    (table: 0x010d9d6548) {
     *[1] = {
        [change_type] = 1
       *[path] = '/Users/runner/work/neovim/neovim/build/Xtest_tmpdir/nvim_KFMvPbXk9a/file' }
      [2] = {
        [change_type] = 3
        [path] = '/Users/runner/work/neovim/neovim/build/Xtest_tmpdir/nvim_KFMvPbXk9a/file' } }

    stack traceback:
            test/functional/lua/watch_spec.lua:149: in function <test/functional/lua/watch_spec.lua:82>

Solution:
Skip test for that exact version.
2024-10-02 16:41:01 +02: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
Christian Clason
391c5084d1 build(deps): bump luajit to HEAD - 97813fb92 2024-10-02 14:41:51 +02:00
Christian Clason
9b15f2a0ce build(deps): bump luajit to HEAD - b2915e9ab 2024-10-02 13:02:46 +02:00
Christian Clason
865ba42e04
build(deps): bump tree-sitter to HEAD - c3d45a015 (#30589) 2024-10-02 06:59:23 +02:00
Christian Clason
3d1e6c56f0 build(deps): bump luajit to HEAD - 2240d8446 2024-10-02 06:27:32 +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