mirror of
https://github.com/neovim/neovim.git
synced 2026-04-29 18:54:18 +00:00
Merge #37830 docs
This commit is contained in:
@@ -2182,7 +2182,7 @@ describe('API', function()
|
||||
eq({ mode = 'n', blocking = false }, api.nvim_get_mode())
|
||||
end)
|
||||
|
||||
it('during press-enter prompt without UI returns blocking=false', function()
|
||||
it('during hit-enter prompt without UI returns blocking=false', function()
|
||||
eq({ mode = 'n', blocking = false }, api.nvim_get_mode())
|
||||
command("echom 'msg1'")
|
||||
command("echom 'msg2'")
|
||||
@@ -2194,7 +2194,7 @@ describe('API', function()
|
||||
eq({ mode = 'n', blocking = false }, api.nvim_get_mode())
|
||||
end)
|
||||
|
||||
it('during press-enter prompt returns blocking=true', function()
|
||||
it('during hit-enter prompt returns blocking=true', function()
|
||||
api.nvim_ui_attach(80, 20, {})
|
||||
eq({ mode = 'n', blocking = false }, api.nvim_get_mode())
|
||||
command("echom 'msg1'")
|
||||
|
||||
@@ -115,6 +115,7 @@ describe('file search', function()
|
||||
eq(expected, eval('expand("<cfile>")'))
|
||||
end
|
||||
|
||||
-- test_cfile([[c:/d:/e:/foo/bar.txt]], 'c:/d:/e') -- TODO(justinmk): should return "d:/foo/bar.txt" ?
|
||||
test_cfile([[c:/d:/foo/bar.txt]]) -- TODO(justinmk): should return "d:/foo/bar.txt" ?
|
||||
test_cfile([[//share/c:/foo/bar/]])
|
||||
test_cfile([[file://c:/foo/bar]])
|
||||
|
||||
@@ -219,7 +219,7 @@ describe('server', function()
|
||||
client:close()
|
||||
end)
|
||||
|
||||
it('removes stale socket files automatically #26053', function()
|
||||
it('removes stale socket files automatically #36581', function()
|
||||
-- Windows named pipes are ephemeral kernel objects that are automatically
|
||||
-- cleaned up when the process terminates. Unix domain sockets persist as
|
||||
-- files on the filesystem and can become stale after crashes.
|
||||
@@ -243,7 +243,7 @@ describe('server', function()
|
||||
fn.serverstop(socket_path)
|
||||
end)
|
||||
|
||||
it('does not remove live sockets #26053', function()
|
||||
it('does not remove live sockets #36581', function()
|
||||
t.skip(is_os('win'), 'N/A on Windows')
|
||||
|
||||
clear()
|
||||
|
||||
@@ -158,7 +158,7 @@ describe(':mksession', function()
|
||||
-- Create a new test instance of Nvim.
|
||||
clear()
|
||||
|
||||
-- Use :silent to avoid press-enter prompt due to long path
|
||||
-- Use :silent to avoid hit-enter prompt due to long path
|
||||
command('silent source ' .. session_path)
|
||||
command('tabnext 1')
|
||||
eq(cwd_dir .. get_pathsep() .. tmpfile_base .. '1', fn.expand('%:p'))
|
||||
|
||||
@@ -4065,7 +4065,7 @@ describe('vim.diagnostic', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('toqflist() and fromqflist()', function()
|
||||
describe('toqflist(), fromqflist()', function()
|
||||
it('works', function()
|
||||
local result = exec_lua(function()
|
||||
vim.diagnostic.set(_G.diagnostic_ns, _G.diagnostic_bufnr, {
|
||||
@@ -4091,95 +4091,71 @@ describe('vim.diagnostic', function()
|
||||
end)
|
||||
|
||||
it('merge_lines=true merges continuation lines', function()
|
||||
local result = exec_lua(function()
|
||||
local qflist = {
|
||||
{
|
||||
bufnr = 1,
|
||||
lnum = 10,
|
||||
col = 5,
|
||||
end_lnum = 10,
|
||||
end_col = 10,
|
||||
text = 'error: [GHC-83865]',
|
||||
type = 'E',
|
||||
nr = 0,
|
||||
valid = 1,
|
||||
},
|
||||
{
|
||||
bufnr = 1,
|
||||
lnum = 0,
|
||||
col = 0,
|
||||
end_lnum = 0,
|
||||
end_col = 0,
|
||||
text = " Couldn't match expected type",
|
||||
type = '',
|
||||
nr = 0,
|
||||
valid = 0,
|
||||
},
|
||||
{
|
||||
bufnr = 1,
|
||||
lnum = 0,
|
||||
col = 0,
|
||||
end_lnum = 0,
|
||||
end_col = 0,
|
||||
text = ' with actual type',
|
||||
type = '',
|
||||
nr = 0,
|
||||
valid = 0,
|
||||
},
|
||||
{
|
||||
bufnr = 1,
|
||||
lnum = 20,
|
||||
col = 1,
|
||||
end_lnum = 20,
|
||||
end_col = 5,
|
||||
text = 'warning: unused',
|
||||
type = 'W',
|
||||
nr = 0,
|
||||
valid = 1,
|
||||
},
|
||||
}
|
||||
return vim.diagnostic.fromqflist(qflist, { merge_lines = true })
|
||||
end)
|
||||
local function get_fromqflist(merge_lines)
|
||||
return exec_lua(function(merge_lines_)
|
||||
local qflist = {
|
||||
{
|
||||
bufnr = 1,
|
||||
lnum = 10,
|
||||
col = 5,
|
||||
end_lnum = 10,
|
||||
end_col = 10,
|
||||
text = 'error: [GHC-83865]',
|
||||
type = 'E',
|
||||
nr = 0,
|
||||
valid = 1,
|
||||
},
|
||||
{
|
||||
bufnr = 1,
|
||||
lnum = 0,
|
||||
col = 0,
|
||||
end_lnum = 0,
|
||||
end_col = 0,
|
||||
text = " Couldn't match expected type",
|
||||
type = '',
|
||||
nr = 0,
|
||||
valid = 0,
|
||||
},
|
||||
{
|
||||
bufnr = 1,
|
||||
lnum = 0,
|
||||
col = 0,
|
||||
end_lnum = 0,
|
||||
end_col = 0,
|
||||
text = ' with actual type',
|
||||
type = '',
|
||||
nr = 0,
|
||||
valid = 0,
|
||||
},
|
||||
{
|
||||
bufnr = 1,
|
||||
lnum = 20,
|
||||
col = 1,
|
||||
end_lnum = 20,
|
||||
end_col = 5,
|
||||
text = 'warning: unused',
|
||||
type = 'W',
|
||||
nr = 0,
|
||||
valid = 1,
|
||||
},
|
||||
}
|
||||
return vim.diagnostic.fromqflist(qflist, { merge_lines = merge_lines_ })
|
||||
end, merge_lines)
|
||||
end
|
||||
|
||||
-- merge_lines=true
|
||||
local result = get_fromqflist(true)
|
||||
eq(2, #result)
|
||||
eq(
|
||||
"error: [GHC-83865]\n Couldn't match expected type\n with actual type",
|
||||
result[1].message
|
||||
)
|
||||
eq('warning: unused', result[2].message)
|
||||
end)
|
||||
|
||||
it('merge_lines=false ignores continuation lines', function()
|
||||
local result = exec_lua(function()
|
||||
local qflist = {
|
||||
{
|
||||
bufnr = 1,
|
||||
lnum = 10,
|
||||
col = 5,
|
||||
end_lnum = 10,
|
||||
end_col = 10,
|
||||
text = 'error: main',
|
||||
type = 'E',
|
||||
nr = 0,
|
||||
valid = 1,
|
||||
},
|
||||
{
|
||||
bufnr = 1,
|
||||
lnum = 0,
|
||||
col = 0,
|
||||
end_lnum = 0,
|
||||
end_col = 0,
|
||||
text = 'continuation',
|
||||
type = '',
|
||||
nr = 0,
|
||||
valid = 0,
|
||||
},
|
||||
}
|
||||
return vim.diagnostic.fromqflist(qflist)
|
||||
end)
|
||||
|
||||
eq(1, #result)
|
||||
eq('error: main', result[1].message)
|
||||
-- merge_lines=false
|
||||
result = get_fromqflist(false)
|
||||
eq(2, #result)
|
||||
eq('error: [GHC-83865]', result[1].message)
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
@@ -145,12 +145,12 @@ describe('vim.ui', function()
|
||||
if not is_os('bsd') then
|
||||
local rv = exec_lua([[
|
||||
local cmd, err = vim.ui.open('non-existent-file')
|
||||
if err then return nil end
|
||||
if err and err:find('no handler found') then
|
||||
return -1
|
||||
end
|
||||
return cmd:wait(100).code
|
||||
]])
|
||||
if type(rv) == 'number' then
|
||||
ok(rv ~= 0, 'nonzero exit code', rv)
|
||||
end
|
||||
ok(type(rv) == 'number' and rv ~= 0, 'nonzero exit code', rv)
|
||||
end
|
||||
|
||||
exec_lua [[
|
||||
|
||||
@@ -752,7 +752,7 @@ describe('vim.lsp.completion: item conversion', function()
|
||||
eq('foobar', result.items[1].user_data.nvim.lsp.completion_item.textEdit.newText)
|
||||
end)
|
||||
|
||||
it('shows snippet source in doc popup if completeopt include popup', function()
|
||||
it('shows snippet source in doc popup if completeopt=popup', function()
|
||||
exec_lua([[
|
||||
vim.opt.completeopt:append('popup')
|
||||
vim.bo.filetype = 'lua'
|
||||
@@ -1362,7 +1362,7 @@ describe('vim.lsp.completion: integration', function()
|
||||
eq('w-1/2', n.api.nvim_get_current_line())
|
||||
end)
|
||||
|
||||
it('completionItem/resolve', function()
|
||||
it('selecting an item triggers completionItem/resolve + preview', function()
|
||||
local screen = Screen.new(50, 20)
|
||||
screen:add_extra_attr_ids({
|
||||
[100] = { background = Screen.colors.Plum1, foreground = Screen.colors.Blue },
|
||||
|
||||
@@ -3313,10 +3313,10 @@ describe('TUI FocusGained/FocusLost', function()
|
||||
]])
|
||||
end)
|
||||
|
||||
it('in press-enter prompt', function()
|
||||
it('in hit-enter prompt', function()
|
||||
t.skip(is_os('win'), 'FIXME: some spaces have wrong attrs on Windows')
|
||||
feed_data(":echom 'msg1'|echom 'msg2'|echom 'msg3'|echom 'msg4'|echom 'msg5'\n")
|
||||
-- Execute :messages to provoke the press-enter prompt.
|
||||
-- Execute :messages to provoke the hit-enter prompt.
|
||||
feed_data(':messages\n')
|
||||
screen:expect([[
|
||||
msg1 |
|
||||
|
||||
@@ -337,25 +337,25 @@ describe('treesitter parser API', function()
|
||||
end)
|
||||
|
||||
local test_text = [[
|
||||
void ui_refresh(void)
|
||||
{
|
||||
int width = INT_MAX, height = INT_MAX;
|
||||
bool ext_widgets[kUIExtCount];
|
||||
for (UIExtension i = 0; (int)i < kUIExtCount; i++) {
|
||||
ext_widgets[i] = true;
|
||||
}
|
||||
void ui_refresh(void)
|
||||
{
|
||||
int width = INT_MAX, height = INT_MAX;
|
||||
bool ext_widgets[kUIExtCount];
|
||||
for (UIExtension i = 0; (int)i < kUIExtCount; i++) {
|
||||
ext_widgets[i] = true;
|
||||
}
|
||||
|
||||
bool inclusive = ui_override();
|
||||
for (size_t i = 0; i < ui_count; i++) {
|
||||
UI *ui = uis[i];
|
||||
width = MIN(ui->width, width);
|
||||
height = MIN(ui->height, height);
|
||||
foo = BAR(ui->bazaar, bazaar);
|
||||
for (UIExtension j = 0; (int)j < kUIExtCount; j++) {
|
||||
ext_widgets[j] &= (ui->ui_ext[j] || inclusive);
|
||||
}
|
||||
}
|
||||
}]]
|
||||
bool inclusive = ui_override();
|
||||
for (size_t i = 0; i < ui_count; i++) {
|
||||
UI *ui = uis[i];
|
||||
width = MIN(ui->width, width);
|
||||
height = MIN(ui->height, height);
|
||||
foo = BAR(ui->bazaar, bazaar);
|
||||
for (UIExtension j = 0; (int)j < kUIExtCount; j++) {
|
||||
ext_widgets[j] &= (ui->ui_ext[j] || inclusive);
|
||||
}
|
||||
}
|
||||
}]]
|
||||
|
||||
it('can iterate over nodes children', function()
|
||||
insert(test_text)
|
||||
@@ -424,7 +424,7 @@ void ui_refresh(void)
|
||||
local tree = parser:parse()[1]
|
||||
return vim.treesitter.get_node_text(tree:root(), 0)
|
||||
end)
|
||||
eq(test_text, res)
|
||||
eq(t.dedent(test_text), res)
|
||||
|
||||
local res2 = exec_lua(function()
|
||||
local parser = vim.treesitter.get_parser(0, 'c')
|
||||
@@ -436,9 +436,9 @@ void ui_refresh(void)
|
||||
|
||||
it('can get text where start of node is one past EOF', function()
|
||||
local text = [[
|
||||
def run
|
||||
a = <<~E
|
||||
end]]
|
||||
def run
|
||||
a = <<~E
|
||||
end]]
|
||||
insert(text)
|
||||
eq(
|
||||
'',
|
||||
@@ -463,9 +463,10 @@ end]]
|
||||
|
||||
it('can get empty text if node range is zero-width', function()
|
||||
local text = [[
|
||||
```lua
|
||||
{}
|
||||
```]]
|
||||
```lua
|
||||
{}
|
||||
```
|
||||
]]
|
||||
insert(text)
|
||||
local result = exec_lua(function()
|
||||
local fake_node = {}
|
||||
@@ -602,12 +603,12 @@ end]]
|
||||
|
||||
before_each(function()
|
||||
insert([[
|
||||
int x = INT_MAX;
|
||||
#define READ_STRING(x, y) (char *)read_string((x), (size_t)(y))
|
||||
#define READ_STRING_OK(x, y) (char *)read_string((x), (size_t)(y))
|
||||
#define VALUE 123
|
||||
#define VALUE1 123
|
||||
#define VALUE2 123
|
||||
int x = INT_MAX;
|
||||
#define READ_STRING(x, y) (char *)read_string((x), (size_t)(y))
|
||||
#define READ_STRING_OK(x, y) (char *)read_string((x), (size_t)(y))
|
||||
#define VALUE 123
|
||||
#define VALUE1 123
|
||||
#define VALUE2 123
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -989,8 +990,8 @@ int x = INT_MAX;
|
||||
describe('when getting the language for a range', function()
|
||||
before_each(function()
|
||||
insert([[
|
||||
int x = INT_MAX;
|
||||
#define VALUE 123456789
|
||||
int x = INT_MAX;
|
||||
#define VALUE 123456789
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -1015,7 +1016,7 @@ int x = INT_MAX;
|
||||
describe('when setting the node for an injection', function()
|
||||
before_each(function()
|
||||
insert([[
|
||||
print()
|
||||
print()
|
||||
]])
|
||||
end)
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ local function treeselect(cmd_, ...)
|
||||
end, cmd_, ...)
|
||||
end
|
||||
|
||||
describe('incremental treesitter selection', function()
|
||||
describe('treesitter incremental-selection', function()
|
||||
before_each(function()
|
||||
clear()
|
||||
|
||||
@@ -66,7 +66,7 @@ describe('incremental treesitter selection', function()
|
||||
eq('foo(1)\nbar(2)\n', get_selected())
|
||||
end)
|
||||
|
||||
it('repeate works', function()
|
||||
it('repeat', function()
|
||||
set_lines('foo(1,2,3,4)')
|
||||
treeselect('select_node')
|
||||
eq('foo', get_selected())
|
||||
@@ -91,7 +91,7 @@ describe('incremental treesitter selection', function()
|
||||
eq('2', get_selected())
|
||||
end)
|
||||
|
||||
it('has history', function()
|
||||
it('history', function()
|
||||
treeselect('select_node')
|
||||
treeselect('select_child')
|
||||
treeselect('select_next')
|
||||
@@ -111,7 +111,7 @@ describe('incremental treesitter selection', function()
|
||||
eq('foo(1)', get_selected())
|
||||
end)
|
||||
|
||||
it('correctly selects node as parent when node half selected', function()
|
||||
it('selects node as parent when node half-selected', function()
|
||||
feed('kkl', 'v', 'l')
|
||||
eq('oo', get_selected())
|
||||
|
||||
@@ -119,7 +119,7 @@ describe('incremental treesitter selection', function()
|
||||
eq('foo', get_selected())
|
||||
end)
|
||||
|
||||
it('correctly selects node as child when node half selected', function()
|
||||
it('selects node as child when node half-selected', function()
|
||||
feed('kkl', 'v', 'l')
|
||||
eq('oo', get_selected())
|
||||
|
||||
@@ -127,7 +127,7 @@ describe('incremental treesitter selection', function()
|
||||
eq('foo', get_selected())
|
||||
end)
|
||||
|
||||
it('correctly find child node when node half selected', function()
|
||||
it('finds child node when node half-selected', function()
|
||||
feed('kkl', 'v', 'j')
|
||||
eq('oo(1)\nba', get_selected())
|
||||
|
||||
@@ -135,7 +135,7 @@ describe('incremental treesitter selection', function()
|
||||
eq('(1)', get_selected())
|
||||
end)
|
||||
|
||||
it('maintainse cursor selection-end-pos', function()
|
||||
it('maintains cursor selection-end-pos', function()
|
||||
feed('kk')
|
||||
treeselect('select_node')
|
||||
eq('foo', get_selected())
|
||||
@@ -174,7 +174,7 @@ describe('incremental treesitter selection', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('incremental treesitter selection with injections', function()
|
||||
describe('treesitter incremental-selection with injections', function()
|
||||
before_each(function()
|
||||
clear({ args_rm = { '--cmd' }, args = { '--clean', '--cmd', n.runtime_set } })
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user