Problem:
LSP basic_finish test modified in #27899 is flaky again after #28030.
Solution:
Run on_setup() immediately after setup using a before_init callback.
Move test cases that are more about treesitter query API rather than
parser API or LanguageTree out of "treesitter/parser_spec", and collect
them in another test suite "treesitter/query_spec".
General refactoring, including:
- Improve whitespace and indentation
- Prefix captures with `@`
- Add more comments on `iter_capture()` tests
- Move `test_query` up closer to the fixture source string
No behavioral changes are made.
This is the first installment of a multi-PR series significantly
refactoring how highlights are being specified.
The end goal is to have a base set of 20 ish most common highlights,
and then specific files only need to add more groups to that as needed.
As a complicating factor, we also want to migrate to the new default
color scheme eventually. But by sharing a base set, that future PR
will hopefully be a lot smaller since a lot of tests will be migrated
just simply by updating the base set in place.
As a first step, fix the anti-pattern than Screen defaults to ignoring
highlights. Highlights are integral part of the screen state, not
something "extra" which we only test "sometimes". For now, we still
allow opt-out via the intentionally ugly
screen._default_attr_ids = nil
The end goal is to get rid of all of these eventually (which will be
easier as part of the color scheme migration)
When the edited file is a symlink, the unexpanded file name is needed to
to achieve the same behavior as the autocommand pattern matching in Vim.
Neither args.file nor args.match are guaranteed to be unexpanded, so use
bufname() instead.
Problem: memleak with ex_drop(), NULL dereference
(zeertzjq)
Solution: revert back to ex_rewind(), use curbuf instead of buf
fixes: vim/vim#14246closes: vim/vim#1425185a769d466
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: :drop tries to :rewind the argumentlist, which results in E37
(after v9.1.0046)
Solution: instead of calling ex_rewind(), call open_buffer() only when
re-using the initial empty buffer
fixes: vim/vim#14219closes: vim/vim#14220978178823b
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: assertion failure in nvim_create_buf if buflist_new autocommands open
a swapfile when "scratch" is set.
Solution: block autocommands when setting up the buffer; fire them later
instead.
Note that, unlike buflist_new, I don't check if autocommands aborted script
processing; the buffer is already created and configured at that point, so might
as well return the handle anyway.
Rather than repeat try_{start,end} and {un}block_autocmds for each relevant
operation, just do it at the start and near the end. This means that, if
TermResponse fires from unblock_autocmds for whatever reason, it can see the
buffer in an already configured state if we didn't bail due to an error (plus
it's probably a bit cleaner this way).
The first describe() block enters terminal mode in before_each(), so
feed_command() at the start of a test case writes it to the terminal
instead of executing it.
Problem:
As mentioned in #23002 on_setup and on_init are run concurrently.
However, in basic_finish tests on_setup must attach the client before
on_init finishes. The other basic_finish test isn't flaky because it
makes an RPC request in on_init.
Solution:
Don't use on_setup in basic_finish tests.
Problem: "NOTE"s, inline Vim script code, and links ending in digits may not be
highlighted correctly within the :Tutor.
Solution: set an explicit value for ":syntax iskeyword" that includes digits. Do
it after ":syntax include"s, so the included syntax/sh.vim doesn't mess with the
value.
Increase screen test width so all text within the conclusion section is visible.
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Problem: Wrong cursor position when clicking after end of line with
'virtualedit', conceal and virtual text.
Solution: Always fill linebuf_vcol[] for the columns to clear.
There is no test for using 'cursorline' in Normal mode in a terminal
buffer, so add a test and fix 'cursorcolumn' remaining when entering
Terminal mode.
Also move synIDattr() tests to ui/highlight_spec.lua.
Problem: Cursor line is unconcealed when pressing 'r' in Normal mode
when 'concealcursor' contains 'n' but not 'i'.
Solution: Don't check conceal when pressing 'r' in Normal mode.
Vim doesn't have this problem because it doesn't call redrawWinline() in
conceal_check_cursor_line() and instead sets a global variable.
Added the following LSP semantic token types to be linked to highlight
groups by default:
* @lsp.type.event
* @lsp.type.keyword
* @lsp.type.modifier
* @lsp.type.number
* @lsp.type.operator
* @lsp.type.regexp
* @lsp.type.string