Commit Graph

30749 Commits

Author SHA1 Message Date
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
zeertzjq
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

baee8448d1

Co-authored-by: dundargoc <gocdundar@gmail.com>
2024-10-01 23:33:25 +00:00
zeertzjq
0e484c2041
vim-patch:9.1.0753: Wrong display when typing in diff mode with 'smoothscroll' (#30614)
Problem:  Wrong display when typing in diff mode with 'smoothscroll'.
Solution: Use adjust_plines_for_skipcol() (zeertzjq).

closes: vim/vim#15776

47f8584a80
2024-10-01 22:55:43 +00:00
Jongwook Choi
5331f87f61
fix(treesitter): indent size for inspect_tree #28727
Problem: For :InspectTree, indent size (`&shiftwidth`) for the tree
viewer may be incorrect.

This is because the tree viewer buffer with the filetype `query` does
not explicitly configures the tab size, which can mismatch with the
default indent size (2) assumed by TSTreeView's implementation.

Solution: Set shiftwidth to be the same as TSTreeViewOpts specifies,
which defaults to 2.
2024-10-01 09:07:30 -07:00
Gregory Anders
bb7604edda
feat(defaults): add default unimpaired style mappings (#28525) 2024-10-01 07:24:43 -05:00
zeertzjq
1c30d86c33
fix(tabline): restore behavior of click after last tabpage (#30602)
Also correct the comments about tabpage labels in custom tabline.
2024-10-01 19:46:30 +08:00
Justin M. Keyes
72892aab06 docs(gen_help_html.lua): h4 pseudo-heading layout
Problem:
The <br> hack in a0c64fe816 causes weird layout if a "h4 pseudo-heading"
is not the only tag on the line. For example in the help text below, the
"*'buflisted'*" tag was treated as h4 and followed by <br>, which is
obviously wrong:

                            *'buflisted'* *'bl'* *'nobuflisted'* *'nobl'* *E85*
    'buflisted' 'bl'    boolean (default on)

Solution:
Only treat a tag as "h4 pseudo-heading" if it is the only tag in the
line. This is fragile, but in practice seems to get the right balance.
2024-10-01 12:51:16 +02:00
Justin M. Keyes
a0c64fe816
docs(gen_help_html.lua): h4 pseudo-heading layout #30609
Problem:
The right-aligned tag "pseudo-heading" layout mushes together with the
left-aligned text. This is especially messy in a narrow viewport.

Solution:
Put a `<br>` on it. This is a hack until tree-sitter-vimdoc recognizes
these pseudo-headings.
2024-10-01 02:52:07 -07:00
Christian Clason
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

85f054aa3f

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Co-authored-by: Tim Pope <code@tpope.net>
2024-10-01 07:33:24 +02:00
Christian Clason
ea9d61b80d vim-patch:9.1.0749: filetype: http files not recognized
Problem:  filetype: http files not recognized
Solution: detect '*.http' as http filetype, include
          http filetype plugin (Riley Bruins)

Based on the specification found
[here](https://github.com/JetBrains/http-request-in-editor-spec/blob/master/spec.md)

closes: vim/vim#15762

de6c1d1182

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2024-10-01 07:33:08 +02:00
zeertzjq
e0efbc6e03
refactor: use ERROR_SET() to check for error (#30594)
Replaces the only two places where kErrorTypeNone is checked explicitly.
2024-10-01 06:27:30 +08:00
Christian Clason
888966652d build(deps): bump luajit to HEAD - f5fd22203 2024-09-30 22:47:09 +02:00
Lewis Russell
2c88cfcac4
Merge pull request #30526 from lewis6991/fix/linematchnul 2024-09-30 12:09:36 +01: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
Justin M. Keyes
20251be15a docs: graduate editorconfig.txt to "flow layout"
fix #25401
2024-09-30 00:43:44 +02: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
zeertzjq
e40314811e
vim-patch:6db3fc5: runtime(doc): reformat gnat example (#30575)
closes: vim/vim#15758

6db3fc5632

Co-authored-by: hokorobi <hokorobi.hokorobi@gmail.com>
2024-09-29 12:35:36 +00:00
zeertzjq
df915f3afc
fix(float): properly find last window of tabpage (#30571) 2024-09-29 10:38:17 +00:00
Christian Clason
006323dd70 vim-patch:ee20fc8: runtime(indent): allow matching negative numbers for gnu indent config file
Some gnu indent options take negative numbers (e.g. --indent-label).
Add matching for an optional single '-' before the number.

closes: vim/vim#15754

ee20fc8062

Co-authored-by: John M Devin <john.m.devin@gmail.com>
2024-09-29 12:23:52 +02:00
dundargoc
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
Christian Clason
1405034ba3 vim-patch:9.1.0745: filetype: bun and deno history files not recognized
Problem:  filetype: bun and deno history files not recognized
Solution: detect '.bun_repl_history' and 'deno_history.txt' as
          javascript filetype (Wu, Zhenyu)

closes: vim/vim#15761

8a2aea8a62

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-09-29 11:13:27 +02:00
zeertzjq
1ff0a1712a
vim-patch:9.1.0746: tests: Test_halfpage_longline() fails on large terminals (#30567)
Problem:  Test_halfpage_longline() fails on large terminals
          (lazypingu)
Solution: Use a window with known width (zeertzjq).

fixes: vim/vim#15755
closes: vim/vim#15756

fa117387ee
2024-09-29 17:05:56 +08:00
zeertzjq
8d99a56269 vim-patch:c3989f1: runtime(doc): reformat ada_standard_types section
closes: vim/vim#15759

c3989f184d

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

998f018df3

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-09-29 17:05:02 +08:00
bfredl
610e9666af
Merge pull request #30401 from bfredl/casefold2
refactor(multibyte): neo-casefolding without allocation
2024-09-29 11:03:36 +02:00
bfredl
2dfa6f6033 refactor(multibyte): neo-casefolding without allocation
fixes #30400
2024-09-29 10:14:16 +02:00
bfredl
69553f7bf5
Merge pull request #30558 from bfredl/noklist
refactor(event): change last use of klist to kvec
2024-09-28 20:59:06 +02:00
bfredl
76163590f0 refactor(event): change last use of klist to kvec
loop->children might have been a linked list because used to be
modified in place while looped over. However the loops that exists
rather schedules events to be processed later, outside of the loop,
so this can not happen anymore.

When a linked list is otherwise useful it is better to use
lib/queue_defs.h which defines an _intrusive_ linked list (i e it
doesn't need to do allocations for list items like klist ).
2024-09-28 20:23:22 +02:00
zeertzjq
d5f6f61879
fix(column): set signcolumn width after splitting window (#30556) 2024-09-28 17:16:22 +08:00
Riley Bruins
4349bdbd0b fix(treesitter): specify success status in edit_query return value 2024-09-28 10:54:45 +02:00
zeertzjq
4f9311b759
fix(window): making float with title/footer non-float leaks memory (#30551) 2024-09-28 10:21:06 +08:00
Riley Bruins
0f067cd34d fix(treesitter): suppress get_parser warnings via opts.error 2024-09-28 00:31:45 +02:00
glepnir
7b71fdbc1e
fix(window): respect hide flag of float windows when switching (#30507) 2024-09-28 06:02:14 +08: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
zeertzjq
f55213ce0e
fix(api): fix crash/leak with float title/footer on error (#30543) 2024-09-27 14:33:24 +00:00
zeertzjq
eea6b84a87
test(api/window_spec): remove duplicate test (#30538) 2024-09-27 19:10:55 +08:00
zeertzjq
60a7578058
vim-patch:9.1.0744: filetype: notmuch configs are not recognised (#30535)
Problem:  filetype: notmuch configs are not recognised
Solution: Detect more notmuch profile configuration files
          as dosini filetype (Julio B)

Reference:
https://notmuchmail.org/doc/latest/man1/notmuch-config.html#configuration

closes: vim/vim#15744

1a2870b57a

Co-authored-by: Julio B <julio.bacel@gmail.com>
2024-09-27 18:57:01 +08:00
Justin M. Keyes
b63cd8cbae
fix(treesitter): EditQuery shows swapfile ATTENTION #30536
Problem:
EditQuery shows swapfile ATTENTION, but this buffer is not intended for
preservation (and the dialog breaks the UX).

Solution:
Set 'noswapfile' on the buffer before renaming it.
2024-09-27 03:27:00 -07:00