Problem: Insufficient testing for indent.c.
Solution: Add indent tests. (Yegappan Lakshmanan, closesvim/vim#5736)
bd7206e02c
Cherry-pick Test_ex_mode() changes from Vim patches 8.2.{0342,0347}.
Reorder test_expand_func.vim to match upstream.
(cherry picked from commit c72857d396)
Problem: Changing 'switchbuf' may have no effect.
Solution: Handle 'switchbuf' in didset_string_options(). (Sean Dewar,
closesvim/vim#10406)
39c46b4378
Guess it doesn't hurt to cherry-pick didset_string_options from v8.1.2045
(but in option.c, for now).
(cherry picked from commit 809790b9f6)
It's special cased by the vimSubst syntax group, and isn't present in Vim's
vimCommand group.
For example, this fixes `call s:Foo()` highlighting `:` as Error in Nvim, as the
`s` is parsed as vimCommand rather than as vimUserFunc since
`contains=vimCommand` was added to vimUserFunc (and vimFunc) in a rt update.
Interestingly, `g:`, `l:`, etc. have the same issues due to :global, :list, etc.
Vim also has that problem, so it should ideally be fixed upstream.
We could also omit g[lobal] from vimCommand and rely on vimGlobal instead, but
it doesn't work in some cases, like when there's a `:` before the command. Also,
Vim matches only `g` in vimCommand for some reason, which doesn't produce any
highlight for `:global/foo/bar` (with Nvim you at least get some highlights on
the `global` bit despite the leading `:`).
Also, remove special handling of :py3 in syntax/vim.vim, as the generator seems
to have no problems finding it.
(cherry picked from commit 53780d9fd0)
* fix(lsp): fix unnecessary buffers being added on empty diagnostics
Some language servers send empty `textDocument/publishDiagnostics`
messages after indexing the project, sometimes resulting in creation
of a lot of unnecessary buffers. As a workaround, skip empty messages
for nonexistent buffers before resolving the filename to a bufnr.
(cherry picked from commit 26eb6785eb)
* Add test
(cherry picked from commit d2e9dab377)
Co-authored-by: ii14 <ii14@users.noreply.github.com>
The LSP progress handler would put non-progress messages (such as from
clangd or pyls; not part of the LSP spec) directly into
`client.messages`, while `vim.lsp.util.get_progress_messages()` would
try to fetch them from `client.messages.messages` instead (and come up
empty everytime). This would result in these messages never being
cleaned up by `get_progress_messages()`.
This commit fixes that by treating those messages like show-once
progress messages (by setting `done=true` immediately).
(cherry picked from commit 2087960c76)
Co-authored-by: Patrice Peterson <patrice.peterson@mailbox.org>
Problem: No text formatting for // comment after a statement.
Solution: format a comment when the 'c' flag is in 'formatoptions'.
48a8a83303
(cherry picked from commit a74c08d524)
Problem: Some users do not want a line comment always inserted.
Solution: Add the '/' flag to 'formatoptions' to not repeat the comment
leader after a statement when using "o".
2bf875f881
(cherry picked from commit d4b9aa4f8e)
Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Problem: "P" in Visual mode still changes some registers.
Solution: Make "P" in Visual mode not change any register. (Shougo
Matsushita, closesvim/vim#10349)
509142ab7a
(cherry picked from commit 28c74ef687)
Problem: When closing help window autocmds triggered for the wrong window.
Solution: Figure out the new current window earlier. (closesvim/vim#10348)
2a2707d033
(cherry picked from commit 71580dfef4)
Problem: :startinsert right after :stopinsert does not work when popup menu
is still visible.
Solution: Use ins_compl_active() instead of pum_visible(). (closesvim/vim#10352)
cd5dbad184
(cherry picked from commit 97d86c45af)
This avoids ignoring too many match results, and avoid highlighting
being blank in some files.
(cherry picked from commit e453b6391e)
Co-authored-by: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
In a locale "en_US", "en" is the language and "US" is the region.
Before this change, we were too clever for our own good and tried to handle the
region as well. But if the macOS primary language is set to "English" and the
region to "Norway", we would end up with "en_NO", which is a locale that does
not exist.
Now we only take the language into account. Taking the example from above would
yield "en_US", which is a sensible fallback.
If the region is important to you, set $LANG and the more specific LC_*
variables in your shell config or alternatively use `:help :language`.
References https://github.com/neovim/neovim/issues/18292
(cherry picked from commit e038625b87)
When 'F' is in 'shortmess', don't show messages when editing a
directory. This fixes a regression introduced by 0956283.
(cherry picked from commit c9f90ee687)
Co-authored-by: Gregory Anders <greg@gpanders.com>
The default value of including F in 'shortmess' has the unfortunate side
effect of hiding output from autocommands. This is a common source of
confusion and often leads people to think their autocommands are not
working when they are. There is a small snippet in the docs for
'shortmess' indicating that the F flag suppresses autocmd output, but
it's not easy to find if you don't already know to look for it.
This commit removes that behavior of the F flag to make it only suppress
file info when opening a new file.
(cherry picked from commit 09562839c3)
Co-authored-by: Gregory Anders <greg@gpanders.com>
`vim.keymap.del` takes an `opts` parameter that lets caller refer to and
delete buffer-local mappings. For some reason the implementation of
`vim.keymap.del` mutates the table that is passed in, setting
`opts.buffer` to `nil`. This is wrong and also undocumented.
(cherry picked from commit 51f33ae5c0)
* fix(treesitter): create new parser if language is not the same as cached parser
Fixes#18148
(cherry picked from commit 8e35894fc2)
* test: create new parser in vim.treesitter.get_parser() when filetype changes
(cherry picked from commit 30e7b3f0a2)
Co-authored-by: Chinmay Dalal <dalal.chinmay.0101@gmail.com>
Use nvim_exec_autocmds to issue the DiagnosticChanged autocommand,
rather than nvim_buf_call, which has some side effects when drawing
statuslines.
(cherry picked from commit 4a64ce140f)
Co-authored-by: Gregory Anders <greg@gpanders.com>
Problem: Test is not cleaned up.
Solution: Make test clean up after itself. Avoid NUL. (closesvim/vim#10233)
7851c69a12
Adapt test_autocmd_vimgrep() to Nvim.
(cherry picked from commit 5e9afca1c1)
Problem: Autocmd events triggered in different order when reusing an empty
buffer.
Solution: Call buff_freeall() earlier. (Charlie Groves, closesvim/vim#10198)
fef4485ef5
Test failure becomes very strange.
(cherry picked from commit f531fb97ff)
Problem: Using freed memory when using an autocommand to split a window
while a buffer is being closed.
Solution: Disallow splitting when the buffer has b_locked_split set.
983d83ff1c
Put the error message in window.c.
Cherry-pick a memory leak fix from Vim patch 8.2.0399.
Test still fails.
(cherry picked from commit 1664e3d4bc)