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.
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.
Some gnu indent options take negative numbers (e.g. --indent-label).
Add matching for an optional single '-' before the number.
closes: vim/vim#15754ee20fc8062
Co-authored-by: John M Devin <john.m.devin@gmail.com>
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#157618a2aea8a62
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Problem: Test_halfpage_longline() fails on large terminals
(lazypingu)
Solution: Use a window with known width (zeertzjq).
fixes: vim/vim#15755closes: vim/vim#15756fa117387ee
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 ).
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')
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.
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#1573506fe70c183
Co-authored-by: Yukihiro Nakadaira <yukihiro.nakadaira@gmail.com>
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!
Problem: getcmdprompt() implementation can be improved
Solution: Improve and simplify it (h-east)
closes: vim/vim#1574325876a6cdd
Co-authored-by: h-east <h.east.727@gmail.com>
Problem: No way to get prompt for input()/confirm()
Solution: add getcmdprompt() function (Shougo Matsushita)
(Shougo Matsushita)
closes: vim/vim#156676908428560
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
**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
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
Problem: When using nvim_paste in a mapping during a macro recording,
both the mapping and the paste are recorded, causing the paste
to be performed twice when replaying the macro.
Solution: Only record a paste when it is from RPC.
Unfortunately this means there is no way for a script to make a recorded
paste. A way to enable that can be discussed later if there is need.
Before this PR, the behavior of nvim_paste is:
- When vim.paste() returns false, return false to the client, but treat
following chunks normally (i.e. rely on the client cancelling the
paste as expected).
- When vim.paste() throws an error, still return true to the client, but
drain the following chunks in the stream without calling vim.paste().
There are two problems with such behavior:
- When vim.paste() errors, the client is still supposed to send the
remaining chunks of the stream, even though they do nothing.
- Having different code paths for two uncommon but similar situations
complicates maintenance.
This PR makes both the cancel case and the error case return false to
the client and drain the remaining chunks of the stream, which, apart
from sharing the same code path, is beneficial whether the client checks
the return value of nvim_paste or not:
- If the client checks the return value, it can avoid sending the
following chunks needlessly after an error.
- If the client doesn't check the return value, chunks following a
cancelled chunk won't be pasted on the server regardless, which leads
to less confusing behavior.
Problem:
fnamemodify with the :r flag will not strip extensions if the filename
starts with a ".". This means that files named ".in" could cause an
infinite loop.
Solution:
Add early return if the filename was not changed
Problem:
`vim.fs.dirname([[C:\User\XXX\AppData\Local]])` returns "." on
mingw/msys2.
Solution:
- Check for "mingw" when deciding `iswin`.
- Use `has("win32")` where possible, it works in "fast" contexts since
b02eeb6a72.