1

Update generated nvim config

This commit is contained in:
2024-06-03 20:37:40 +02:00
parent 8c55c21341
commit 83e285850f
295 changed files with 32868 additions and 0 deletions

View File

@ -0,0 +1,5 @@
Error Warning Info Hint
Error
Warning
Info
Hint

View File

@ -0,0 +1,4 @@
Error
Warning
Info
Hint

View File

@ -0,0 +1,34 @@
local severity = vim.diagnostic.severity
_G.diag_ns = vim.api.nvim_create_namespace('mock-diagnostics')
-- Open files
vim.cmd('edit tests/dir-extra/mocks/diagnostic-file-1')
_G.buf_id_1 = vim.api.nvim_get_current_buf()
vim.cmd('edit tests/dir-extra/mocks/diagnostic-file-2')
_G.buf_id_2 = vim.api.nvim_get_current_buf()
-- Define diagnostic
--stylua: ignore
_G.diagnostic_arr = {
-- Several entries on one line
{ bufnr = buf_id_1, lnum = 0, end_lnum = 0, col = 0, end_col = 5, message = 'Error 1', severity = severity.ERROR },
{ bufnr = buf_id_1, lnum = 0, end_lnum = 0, col = 6, end_col = 13, message = 'Warning 1', severity = severity.WARN },
{ bufnr = buf_id_1, lnum = 0, end_lnum = 0, col = 14, end_col = 18, message = 'Info 1', severity = severity.INFO },
{ bufnr = buf_id_1, lnum = 0, end_lnum = 0, col = 19, end_col = 23, message = 'Hint 1', severity = severity.HINT },
-- Entries on separate lines not at line start
{ bufnr = buf_id_1, lnum = 1, end_lnum = 1, col = 2, end_col = 7, message = 'Error 2', severity = severity.ERROR },
{ bufnr = buf_id_1, lnum = 2, end_lnum = 2, col = 2, end_col = 9, message = 'Warning 2', severity = severity.WARN },
{ bufnr = buf_id_1, lnum = 3, end_lnum = 3, col = 2, end_col = 6, message = 'Info 2', severity = severity.INFO },
{ bufnr = buf_id_1, lnum = 4, end_lnum = 4, col = 2, end_col = 6, message = 'Hint 2', severity = severity.HINT },
-- Another buffer
{ bufnr = buf_id_2, lnum = 0, end_lnum = 0, col = 0, end_col = 5, message = 'Error 3', severity = severity.ERROR },
{ bufnr = buf_id_2, lnum = 1, end_lnum = 1, col = 0, end_col = 7, message = 'Warning 3', severity = severity.WARN },
{ bufnr = buf_id_2, lnum = 2, end_lnum = 2, col = 0, end_col = 4, message = 'Info 3', severity = severity.INFO },
{ bufnr = buf_id_2, lnum = 3, end_lnum = 3, col = 0, end_col = 4, message = 'Hint 3', severity = severity.HINT },
}
-- Set diagnostic
vim.diagnostic.set(diag_ns, buf_id_1, vim.tbl_filter(function(x) return x.bufnr == buf_id_1 end, _G.diagnostic_arr), {})
vim.diagnostic.set(diag_ns, buf_id_2, vim.tbl_filter(function(x) return x.bufnr == buf_id_2 end, _G.diagnostic_arr), {})

View File

@ -0,0 +1,18 @@
commit 1111111111111111111111111111111111111111
Author: Mini Nvim <mini.nvim@emailaddress.com>
Date: Thu Jan 1 11:11:11 1970 +0300
Initial commit.
diff --git a/git-files/git-file-1 b/git-files/git-file-1
index 1111111..0123456 100644
--- a/git-files/git-file-1
+++ b/git-files/git-file-1
@@ -1,5 +1,5 @@
Line 1-1
-Line 1-2
Line 1-3
Line 1-4
Line 1-5
+Line 1-6

View File

@ -0,0 +1,47 @@
diff --git a/git-files/git-file-1 b/git-files/git-file-1
index c139d4e..234d24d 100644
--- a/git-files/git-file-1
+++ b/git-files/git-file-1
@@ -1,4 +1,3 @@
-Line 1-1
Line 1-2
Line 1-3
Line 1-4
@@ -9,6 +8,7 @@ Line 1-8
Line 1-9
Line 1-10
Line 1-11
+Line new
Line 1-12
Line 1-13
Line 1-14
@@ -18,4 +18,4 @@ Line 1-17
Line 1-18
Line 1-19
Line 1-20
-Line 1-21
+Line changed
diff --git a/git-files/git-file-2 b/git-files/git-file-2
index e45e3de..bd830d0 100644
--- a/git-files/git-file-2
+++ b/git-files/git-file-2
@@ -1,5 +1,4 @@
Line 2-1
-Line 2-2
Line 2-3
Line 2-4
Line 2-5
@@ -10,10 +9,11 @@ Line 2-9
Line 2-10
Line 2-11
Line 2-12
+Line new
Line 2-13
Line 2-14
Line 2-15
-Line 2-16
+Line changed
Line 2-17
Line 2-18
Line 2-19

View File

@ -0,0 +1,23 @@
diff --git a/git-files/git-file-1 b/git-files/git-file-1
index c139d4e..234d24d 100644
--- a/git-files/git-file-1
+++ b/git-files/git-file-1
@@ -1 +0,0 @@
-Line 1-1
@@ -11,0 +11 @@ Line 1-11
+Line new
@@ -21 +21 @@ Line 1-20
-Line 1-21
+Line changed
diff --git a/git-files/git-file-2 b/git-files/git-file-2
index e45e3de..bd830d0 100644
--- a/git-files/git-file-2
+++ b/git-files/git-file-2
@@ -2 +1,0 @@ Line 2-1
-Line 2-2
@@ -12,0 +12 @@ Line 2-12
+Line new
@@ -16 +16 @@ Line 2-15
-Line 2-16
+Line changed

View File

@ -0,0 +1,57 @@
diff --git a/git-files/git-file-1 b/git-files/git-file-1
index c139d4e..234d24d 100644
--- a/git-files/git-file-1
+++ b/git-files/git-file-1
@@ -1,21 +1,21 @@
-Line 1-1
Line 1-2
Line 1-3
Line 1-4
Line 1-5
Line 1-6
Line 1-7
Line 1-8
Line 1-9
Line 1-10
Line 1-11
+Line new
Line 1-12
Line 1-13
Line 1-14
Line 1-15
Line 1-16
Line 1-17
Line 1-18
Line 1-19
Line 1-20
-Line 1-21
+Line changed
diff --git a/git-files/git-file-2 b/git-files/git-file-2
index e45e3de..bd830d0 100644
--- a/git-files/git-file-2
+++ b/git-files/git-file-2
@@ -1,21 +1,21 @@
Line 2-1
-Line 2-2
Line 2-3
Line 2-4
Line 2-5
Line 2-6
Line 2-7
Line 2-8
Line 2-9
Line 2-10
Line 2-11
Line 2-12
+Line new
Line 2-13
Line 2-14
Line 2-15
-Line 2-16
+Line changed
Line 2-17
Line 2-18
Line 2-19
Line 2-20
Line 2-21

View File

@ -0,0 +1,12 @@
local tmp = 1
local keymap_rhs = function()
-- Comment
_G.been_here = true
end
--stylua: ignore
vim.api.nvim_set_keymap(
'n', 'ga', '',
{ callback = keymap_rhs, desc = 'Keymap with callback' }
)

View File

@ -0,0 +1,96 @@
local filename = vim.fn.fnamemodify('tests/dir-extra/real-files/a.lua', ':p')
_G.lsp_buf_calls = {}
local make_context = function(lsp_method)
return {
bufnr = vim.api.nvim_get_current_buf(),
method = lsp_method,
-- There are more fields, but none are relevant
}
end
vim.lsp.buf.declaration = function(opts)
table.insert(_G.lsp_buf_calls, 'declaration')
local data = {
context = make_context('textDocument/declaration'),
items = { { col = 16, filename = filename, lnum = 3, text = ' x = math.max(a, 2),' } },
title = 'Declaration',
}
opts.on_list(data)
end
vim.lsp.buf.definition = function(opts)
table.insert(_G.lsp_buf_calls, 'definition')
local data = {
context = make_context('textDocument/definition'),
items = { { col = 16, filename = filename, lnum = 3, text = ' x = math.max(a, 2),' } },
title = 'Definition',
}
opts.on_list(data)
end
vim.lsp.buf.document_symbol = function(opts)
table.insert(_G.lsp_buf_calls, 'document_symbol')
local data = {
context = make_context('textDocument/documentSymbol'),
items = {
{ col = 7, filename = filename, kind = 'Number', lnum = 1, text = '[Number] a' },
{ col = 7, filename = filename, kind = 'Object', lnum = 2, text = '[Object] t' },
{ col = 3, filename = filename, kind = 'Variable', lnum = 3, text = '[Variable] x' },
{ col = 3, filename = filename, kind = 'Variable', lnum = 4, text = '[Variable] y' },
},
title = 'Symbols in a.lua',
}
opts.on_list(data)
end
vim.lsp.buf.implementation = function(opts)
table.insert(_G.lsp_buf_calls, 'implementation')
local data = {
context = make_context('textDocument/implementation'),
items = { { col = 16, filename = filename, lnum = 3, text = ' x = math.max(a, 2),' } },
title = 'Implementation',
}
opts.on_list(data)
end
vim.lsp.buf.references = function(_, opts)
table.insert(_G.lsp_buf_calls, 'references')
local data = {
context = make_context('textDocument/references'),
items = {
{ col = 7, filename = filename, lnum = 1, text = 'local a = 1' },
{ col = 16, filename = filename, lnum = 3, text = ' x = math.max(a, 2),' },
{ col = 16, filename = filename, lnum = 4, text = ' y = math.min(a, 2),' },
},
title = 'References',
}
opts.on_list(data)
end
vim.lsp.buf.type_definition = function(opts)
table.insert(_G.lsp_buf_calls, 'type_definition')
local data = {
context = make_context('textDocument/typeDefinition'),
items = { { col = 16, filename = filename, lnum = 3, text = ' x = math.max(a, 2),' } },
title = 'Type definition',
}
opts.on_list(data)
end
vim.lsp.buf.workspace_symbol = function(query, opts)
table.insert(_G.lsp_buf_calls, 'workspace_symbol')
_G.workspace_symbol_query = query
local data = {
context = make_context('textDocument/workspaceSymbol'),
items = {
{ col = 7, filename = filename, kind = 'Number', lnum = 1, text = '[Number] a' },
{ col = 7, filename = filename, kind = 'Object', lnum = 2, text = '[Object] t' },
{ col = 3, filename = filename, kind = 'Variable', lnum = 3, text = '[Variable] x' },
{ col = 3, filename = filename, kind = 'Variable', lnum = 4, text = '[Variable] y' },
},
title = "Symbols matching ''",
}
opts.on_list(data)
end

View File

@ -0,0 +1,55 @@
_G.process_log = {}
local n_pid, n_stream = 0, 0
local new_process = function(pid)
return {
pid = pid,
close = function(_) table.insert(_G.process_log, 'Process ' .. pid .. ' was closed.') end,
}
end
-- Mock streams by using global `_G.stdout_data_feed` and `_G.stderr_data_feed`
-- arrays as source. Each feed's element should be either string (for usable
-- data) or a table with `err` field (for error).
local stream_counts = {}
vim.loop.new_pipe = function()
-- NOTE: Use `_G.stream_type_queue` to determine which stream type to create
-- (for log purposes). This is to account for `vim.loop.spawn` creating
-- different sets of streams. Assume 'stdout' by default.
if _G.stream_type_queue == nil or #_G.stream_type_queue == 0 then _G.stream_type_queue = { 'stdout' } end
local stream_type = _G.stream_type_queue[1]
table.remove(_G.stream_type_queue, 1)
local new_count = (stream_counts[stream_type] or 0) + 1
stream_counts[stream_type] = new_count
local cur_stream_id = stream_type .. '_' .. new_count
return {
read_start = function(_, callback)
-- It is not possible in Neovim<=0.9 to execute `vim.fn` functions during
-- `pipe:read_start()`
local data_feed = stream_type == 'stdout' and _G.stdout_data_feed or _G.stderr_data_feed
for _, x in ipairs(data_feed or {}) do
if type(x) == 'table' then callback(x.err, nil) end
if type(x) == 'string' then callback(nil, x) end
end
callback(nil, nil)
end,
close = function() table.insert(_G.process_log, string.format('%s was closed.', cur_stream_id)) end,
}
end
_G.spawn_log = {}
vim.loop.spawn = function(path, options, on_exit)
local options_without_callables = vim.deepcopy(options)
options_without_callables.stdio = nil
table.insert(_G.spawn_log, { executable = path, options = options_without_callables })
vim.schedule(function() on_exit() end)
n_pid = n_pid + 1
local pid = 'Pid_' .. n_pid
return new_process(pid), pid
end
vim.loop.process_kill = function(process) table.insert(_G.process_log, 'Process ' .. process.pid .. ' was killed.') end