Commit Graph
4344 Commits
Author SHA1 Message Date
Riley Bruins e049c6e4c0 feat(ui): statusline text inherits highlights #29976
Changes apply to the winbar, statusline, and tabline text.
2024-10-12 10:57:31 -07:00
zeertzjq 45f8f957c0 docs(lua): clarify when on_key "typed" will be empty (#30774) 2024-10-12 12:20:06 +08:00
zeertzjq 0e42c81c7f fix(lua): avoid recursive vim.on_key() callback (#30753) 2024-10-12 08:07:05 +08:00
Gregory Anders 26e765f905 feat(defaults): map gri to vim.lsp.buf.implementation() (#30764)
Continuing the default LSP maps under the "gr" prefix. Mnemonic: "i" for
"implementation".
2024-10-11 11:56:21 -05:00
Riley Bruins d3193afc25 fix(treesitter): remove duplicate symbol names in language.inspect()
**Problems:**

- `vim.treesitter.language.inspect()` returns duplicate
  symbol names, sometimes up to 6 of one kind in the case of `markdown`
- The list-like `symbols` table can have holes and is thus not even a
  valid msgpack table anyway, mentioned in a test

**Solution:** Return symbols as a map, rather than a list, where field
names are the names of the symbol. The boolean value associated with the
field encodes whether or not the symbol is named.

Note that anonymous nodes are surrounded with double quotes (`"`) to
prevent potential collisions with named counterparts that have the same
identifier.
2024-10-11 18:15:07 +02:00
Riley Bruins 267c7525f7 feat(treesitter): introduce child_with_descendant()
This commit also marks `child_containing_descendant()` as deprecated
(per upstream's documentation), and uses `child_with_descendant()` in
its place. Minimum required tree-sitter version will now be `0.24`.
2024-10-11 17:29:45 +02:00
Riley Bruins a0e3fe5741 feat(ui): cascading style inheritance for Pmenu* highlights #29980
- `PmenuSel` and `PmenuMatch` inherit from `Pmenu`
- `PmenuMatchSel` inherits from both `PmenuSel` and `PmenuMatch`
2024-10-10 23:26:25 -07:00
zeertzjq 6f1601a1b9 vim-patch:9.1.0774: "shellcmdline" doesn't work with getcompletion() (#30750)
Problem:  "shellcmdline" doesn't work with getcompletion().
Solution: Use set_context_for_wildcard_arg() (zeertzjq).

closes: vim/vim#15834

https://github.com/vim/vim/commit/85f36d61e09b12d6f1c60201129823371daa4a84
2024-10-10 22:48:45 +00:00
zeertzjqandglepnir 8450752f46 vim-patch:9.1.0771: completion attribute hl_group is confusing
Problem:  Currently completion attribute hl_group is combined with
          all items, which is redundant and confusing with kind_hlgroup
Solution: Renamed to abbr_hlgroup and combine it only with the abbr item
          (glepnir).

closes: vim/vim#15818

https://github.com/vim/vim/commit/0fe17f8ffbd2588ecd2bf42dced556897bc64f89

Co-authored-by: glepnir <glephunter@gmail.com>
2024-10-10 07:21:02 +08:00
zeertzjq 8ef3dd3afa docs(lua): "vim.bo" is always equivalent to :setlocal (#30733)
vim.bo

    :lua vim.bo.textwidth = 80
    :setglobal textwidth?
      textwidth=0

:setlocal

    :setlocal textwidth=80
    :setglobal textwidth?
      textwidth=0

:set

    :set textwidth=80
    :setglobal textwidth?
      textwidth=80
2024-10-09 11:31:14 +00:00
zeertzjqandRuslan Russkikh f449a38f6a vim-patch:9.1.0770: current command line completion is a bit limited (#30728)
Problem:  current command completion is a bit limited
Solution: Add the shellcmdline completion type and getmdcomplpat()
          function (Ruslan Russkikh).

closes: vim/vim#15823

https://github.com/vim/vim/commit/0407d621bbad020b840ffbbbd25ba023bbc05edd

Co-authored-by: Ruslan Russkikh <dvrussk@yandex.ru>
2024-10-09 08:14:18 +08:00
Justin M. Keyes 214ce8d33c fix(gen_help_html): first tag in h2 is broken #30720
Problem:
In h2 headings, the first tag points to an invalid anchor. This used to
work but regressed a few months ago, possibly related to
ceea6898a8.

Solution:
- Simplify the logic, don't try to be clever:
  - Always use to_heading_tag() for the h2 `id`.
- Also:
  - Render tags as `<span>`, because `<code>` is unnecessary and doesn't
    look great in headings.
  - In the main h1, use "foo.txt" as the anchor `name` (rarely used),
    prefer the next found tag for the `href`.
2024-10-08 07:42:20 -07:00
zeertzjq 5805716ca4 vim-patch:9.1.0765: No test for patches 6.2.418 and 7.3.489 (#30713)
Problem:  No test for patches 6.2.418 and 7.3.489
Solution: Add a test.  Fix some whitespace problems in test_mapping.vim.
          Document the behavior (zeertzjq).

closes: vim/vim#15815

https://github.com/vim/vim/commit/5df3cb2898d8b4ad42ac367a436afc79bffecfb4
2024-10-07 22:51:57 +00:00
Christian ClasonandKonfekt 4ea0f1ec23 vim-patch:af449f6: runtime(compiler): add cppcheck linter compiler plugin
closes: vim/vim#15804

https://github.com/vim/vim/commit/af449f69c7cc9f0ffafaa6e0d028dccd1c358763

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2024-10-07 19:19:15 +02:00
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 7335988ce6 docs: generate params/returns in builtin.txt #30654 2024-10-07 05:32:49 -07:00
zeertzjqandMilly 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

https://github.com/vim/vim/commit/a9c6f90918d0012d1b8c8c5c1dccb77407f553fb

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-07 02:22:52 +00:00
zeertzjqandChristian Brabandt d0dc2920e1 vim-patch:fd4e47e: runtime(doc): clarify the effect of 'startofline' option (#30701)
fixes: vim/vim#15794

https://github.com/vim/vim/commit/fd4e47e06b77fa26cb38f057aba950449e1f47f6

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-10-07 07:30:50 +08: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
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
zeertzjqandMilly bd56c1e41f vim-patch:partial:89872f5: runtime(doc): update formatting and syntax
closes: vim/vim#15800

https://github.com/vim/vim/commit/89872f58a9938142417906fc3243257c67c0af9c

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

https://github.com/vim/vim/commit/738ebfea4144dde3d6f25431631d7b821ca22d4d

Co-authored-by: h-east <h.east.727@gmail.com>
2024-10-06 07:44:34 +08: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
Justin M. Keyes 9a5bbaf813 docs: more @since annotations #30660 2024-10-04 08:12:17 -07: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
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
zeertzjqandMilly aeea63081c vim-patch:ae62fe5: runtime(doc): 'filetype', 'syntax' and 'keymap' only allow alphanumeric + some characters (#30630)
closes: vim/vim#15783

https://github.com/vim/vim/commit/ae62fe5c289e148b92b1d0bb912dcce7ebe14602

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

https://github.com/vim/vim/commit/6a89c94a9eeee53481ced1a1260a177bffde4c0f
2024-10-03 06:45:01 +08:00
zeertzjqandMilly 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

https://github.com/vim/vim/commit/25732435c56d762abb260499680939bd8882c708

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-01 23:39:28 +00:00
zeertzjqanddundargoc d983599613 vim-patch:baee844: runtime(doc): add usr tag to usr_toc.txt (#30617)
When typing `:h usr` it redirects to usr_01.txt, but I'd argue
usr_toc.txt is more useful as you can see an overview of all manuals.
When I usr `:h usr` I personally always intend to go to `usr_toc`.

closes: vim/vim#15779

https://github.com/vim/vim/commit/baee8448d1dc803d01ed61beff2a135827b1b8e3

Co-authored-by: dundargoc <gocdundar@gmail.com>
2024-10-01 23:33:25 +00:00
Gregory Anders bb7604edda feat(defaults): add default unimpaired style mappings (#28525) 2024-10-01 07:24:43 -05:00
2f2f434613 vim-patch:85f054a: runtime(java): Recognise the CommonMark form (///) of Javadoc comments
Complement "g:java_ignore_javadoc" with "g:java_ignore_html"
and "g:java_ignore_markdown" to allow selectively disabling
the recognition of HTML and CommonMark respectively.

(Note that this is not a preview feature.)

======================== LIMITATION ========================

According to the syntactical details of JEP 467:

> Any leading whitespace and the three initial / characters
> are removed from each line.
>
> The lines are shifted left, by removing leading whitespace
> characters, until the non-blank line with the least
> leading whitespace has no remaining leading whitespace.
>
> Additional leading whitespace and any trailing whitespace
> in each line is preserved, because it may be significant.

the following example:
------------------------------------------------------------
///    A summary sentence.
///     A list:
///      - Item A.
///     - Item B.
///
///     Some code span, starting here `
///      1 + 2 ` and ending at the previous \`.
------------------------------------------------------------

should be interpreted as if it were written thus:
------------------------------------------------------------
///A summary sentence.
/// A list:
///  - Item A.
/// - Item B.
///
/// Some code span, starting here `
///  1 + 2 ` and ending at the previous \`.
------------------------------------------------------------

Since automatic line rewriting will not be pursued, parts of
such comments having significant whitespace may be ‘wrongly’
highlighted.  For convenience, a &fex function is defined to
‘correct’ it: g:javaformat#RemoveCommonMarkdownWhitespace()
(:help ft-java-plugin).

References:
https://openjdk.org/jeps/467
https://spec.commonmark.org/0.31.2

closes: vim/vim#15740

https://github.com/vim/vim/commit/85f054aa3f0fb9530712d0897e3c8ba29946fad4

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Co-authored-by: Tim Pope <code@tpope.net>
2024-10-01 07:33:24 +02:00
Lewis Russell 0fb5299e53 test: refactor exec_lua in xdiff_spec 2024-09-30 11:51:33 +01:00
Lewis Russell c65646c247 fix(diff): use mmfile_t in linematch
Problem:

Linematch used to use strchr to navigate a string, however strchr does
not supoprt embedded NULs.

Solution:

Use `mmfile_t` instead of `char *` in linematch and introduce `strnchr()`.

Also remove heap allocations from `matching_char_iwhite()`

Fixes: #30505
2024-09-30 11:51:33 +01:00
Christian Clason 99e0facf3a feat(treesitter)!: use return values in language.add()
Problem: No clear way to check whether parsers are available for a given
language.

Solution: Make `language.add()` return `true` if a parser was
successfully added and `nil` otherwise. Use explicit `assert` instead of
relying on thrown errors.
2024-09-29 15:27:16 +02:00
Christian Clason 041d98fe8d feat(treesitter)!: add default fallback to ft_to_lang lookups
Problem: Language names are only registered for filetype<->language
lookups when parsers are actually loaded; this means users cannot rely
on `vim.treesitter.language.get_lang()` or `get_filetypes()` to return
the correct value when language and filetype coincide and always need to
add explicit fallbacks.

Solution: Always return the language name as valid filetype in
`get_filetypes()`, and default to the filetype in `get_lang()`. Document
this behavior.
2024-09-29 15:27:16 +02:00
zeertzjqandhokorobi e40314811e vim-patch:6db3fc5: runtime(doc): reformat gnat example (#30575)
closes: vim/vim#15758

https://github.com/vim/vim/commit/6db3fc5632c877062d759356c025fe06e9dc3630

Co-authored-by: hokorobi <hokorobi.hokorobi@gmail.com>
2024-09-29 12:35:36 +00:00
2c937d723d docs: misc (#30177)
Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Co-authored-by: Riley Bruins <ribru17@hotmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-09-29 09:54:12 +00:00
zeertzjqandhokorobi 8d99a56269 vim-patch:c3989f1: runtime(doc): reformat ada_standard_types section
closes: vim/vim#15759

https://github.com/vim/vim/commit/c3989f184d4dd1ee817c06bb3c04d5471382dd04

Co-authored-by: hokorobi <hokorobi.hokorobi@gmail.com>
2024-09-29 17:05:02 +08:00
zeertzjqandChristian Brabandt 9db304b451 vim-patch:998f018: runtime(doc): include short form for :earlier/:later
fixes: vim/vim#15757

https://github.com/vim/vim/commit/998f018df37088455bd68ad79da3d16bc4ad9bbe

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-09-29 17:05:02 +08:00
Riley Bruins 0f067cd34d fix(treesitter): suppress get_parser warnings via opts.error 2024-09-28 00:31:45 +02:00
Justin M. Keyes 09d76afe84 feat(defaults): pretty :help headings #30544
Problem:
Headings in :help do not stand out visually.

Solution:
Define a non-standard `@markup.heading.1.delimiter` group and
special-case it in `highlight_group.c`.

FUTURE:
This is a cheap workaround until we have #25718 which will enable:
- fully driven by `vimdoc/highlights.scm` instead of using highlight
  tricks (`guibg=bg guifg=bg guisp=fg`)
- better support of "cterm" ('notermguicolors')
2024-09-27 08:53:30 -07:00
zeertzjqandDoug Kearns 7860fd98ae vim-patch:2c41dad: runtime(doc): Fix typo in :help :command-modifiers
closes: vim/vim#15734

https://github.com/vim/vim/commit/2c41dad3873e71cdd4076907cf35e985d0d7a0d1

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-09-27 06:43:29 +08:00
zeertzjqandMilly 18bba09491 vim-patch:d9af78b: runtime(docs): update :set? command behavior table
closes: vim/vim#15746

https://github.com/vim/vim/commit/d9af78b9450362847b344f8dc0f68d015b428d03

Co-authored-by: Milly <milly.ca@gmail.com>
2024-09-27 06:43:06 +08:00
zeertzjqandShougo Matsushita c2fb1fc700 vim-patch:9.1.0741: No way to get prompt for input()/confirm()
Problem:  No way to get prompt for input()/confirm()
Solution: add getcmdprompt() function (Shougo Matsushita)
          (Shougo Matsushita)

closes: vim/vim#15667

https://github.com/vim/vim/commit/6908428560a0d6ae27bf7af6fcb6dc362e31926c

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
2024-09-26 22:15:28 +08:00
Nathan Smith 921dc22fc0 fix(diagnostic): correct severity type on setqflist, setloclist (#30506)
fix(diagnostic): correct severity type on setqflist, setloclist
2024-09-25 10:10:50 -05:00
Justin M. Keyes f3b7444e66 refactor(lua): vim.keymap.set tests, docs #30511 2024-09-25 07:01:27 -07:00