Commit Graph

30733 Commits

Author SHA1 Message Date
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
zeertzjq
6f2fe8a791
vim-patch:9.1.0743: diff mode does not handle overlapping diffs correctly (#30532)
Problem:  diff mode does not handle overlapping diffs correctly
Solution: correct the logic to handle overlapping blocks
          (Yukihiro Nakadaira)

Vim merges overlapped diff blocks and it doesn't work expectedly
in some situation.

closes: vim/vim#15735

06fe70c183

Co-authored-by: Yukihiro Nakadaira <yukihiro.nakadaira@gmail.com>
2024-09-27 07:14:39 +00:00
zeertzjq
a9287dd882
fix(mbyte): check for utf8proc_map() failure (#30531) 2024-09-26 23:40:46 +00:00
zeertzjq
98d1c0ebef
Merge pull request #30530 from zeertzjq/vim-d9af78b
vim-patch: doc updates
2024-09-27 07:22:54 +08:00
zeertzjq
7860fd98ae vim-patch:2c41dad: runtime(doc): Fix typo in :help :command-modifiers
closes: vim/vim#15734

2c41dad387

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

d9af78b945

Co-authored-by: Milly <milly.ca@gmail.com>
2024-09-27 06:43:06 +08:00
Justin M. Keyes
f2fa4ca97e
feat(health): highlight headings #30525
Problem:
checkhealth report sections are not visually separated.

Solution:
Highlight with "reverse".

TODO: migrate checkhealth filetype to use treesitter.
TODO: default :help should also highlight headings more boldy!
2024-09-26 07:45:03 -07:00
zeertzjq
efcfcb1efc
Merge pull request #30489 from zeertzjq/vim-9.1.0741
vim-patch:9.1.{0741,0742}: No way to get prompt for input()/confirm()
2024-09-26 22:36:12 +08:00
zeertzjq
65b6cd1b3a vim-patch:9.1.0742: getcmdprompt() implementation can be improved
Problem:  getcmdprompt() implementation can be improved
Solution: Improve and simplify it (h-east)

closes: vim/vim#15743

25876a6cdd

Co-authored-by: h-east <h.east.727@gmail.com>
2024-09-26 22:18:19 +08:00
zeertzjq
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

6908428560

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
2024-09-26 22:15:28 +08:00
zeertzjq
66197dde70
test(api/buffer_updates_spec): prevent flakiness (#30521)
Use poke_eventloop() to wait for Nvim to finish processing input.
2024-09-26 18:34:35 +08:00
zeertzjq
8070988247
fix(channel): handle writing to file instead of pipe (#30519) 2024-09-26 08:36:50 +00:00
Riley Bruins
64847fbdc9 perf(treesitter): use child_containing_descendant() in is_ancestor()
**Problem:** `is_ancestor()` uses a slow, bottom-up parent lookup which
has performance pitfalls detailed in #28512.

**Solution:** Take `is_ancestor()` from $O(n^2)$ to $O(n)$ by
incorporating the use of the `child_containing_descendant()` function
2024-09-25 23:01:08 +02: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
dundargoc
046e0956ee build: fix or silence new clang-tidy warnings 2024-09-25 16:09:08 +02:00
Justin M. Keyes
f3b7444e66
refactor(lua): vim.keymap.set tests, docs #30511 2024-09-25 07:01:27 -07:00
Justin M. Keyes
069451bb21
fix(coverity): size_t overflow #30497
CID 497370: Overflowed constant (INTEGER_OVERFLOW)
    Expression `tsize - ret.has_type_key`, where tsize=0 and
    ret.has_type_key=1, underflows the type that
    receives it, an unsigned integer 64 bits wide.

    CID 509910: Overflowed constant (INTEGER_OVERFLOW)
    Expression stack.size++, which is equal to 0, where stack.size is
    known to be equal to 18446744073709551615, overflows the type that
    receives it, an unsigned integer 64 bits wide
2024-09-25 03:25:49 -07:00