Native VBS and CMake builds of the server and every registered suite: protocol and document sync, VBS/compdb providers, stock GCC diagnostics (including in-process default profile preparation), the stock occurrence observer and hover/definition, the bounded Scheduler, C++ module graph, scan and artifact cache with real CMI production, the context-aware symbol index with schema-2 snapshot migration, navigation and guarded rename, reflection provenance with splice-origin extraction, index-backed completion and signature help, live GCC worker control with a registered DAP suite, and the Neovim and VS Code clients. VoidLibrary follows main. The private GCC 16.2.0 frontend is reproduced from the versioned patches and verified stepping reflection/template code with projected values 17/34 and 41/82.
57 lines
2.7 KiB
Lua
57 lines
2.7 KiB
Lua
-- Exercise a real unsaved edit through the built-in Neovim LSP client.
|
|
local server = assert(vim.env.VLS_SERVER, "set VLS_SERVER to the installed vls")
|
|
local profile_path = assert(vim.env.VLS_GCC_PROFILE, "set VLS_GCC_PROFILE to the prepared stock GCC profile")
|
|
local profile = vim.json.decode(table.concat(vim.fn.readfile(profile_path), "\n"))
|
|
local root = vim.fn.tempname()
|
|
assert(vim.fn.mkdir(root) == 1)
|
|
local file = root .. "/unit.cpp"
|
|
local client
|
|
|
|
local function wait_for(label, predicate)
|
|
assert(vim.wait(15000, predicate, 25), "timed out waiting for " .. label)
|
|
end
|
|
|
|
local function run()
|
|
local original = "int read() { return value; }"
|
|
assert(vim.fn.writefile({ "int value = 17;", original }, file) == 0)
|
|
local row = { file = file, directory = root,
|
|
arguments = { profile.driver.path, "-std=c++26", "-freflection", "-c", file } }
|
|
assert(vim.fn.writefile({ vim.json.encode({ row }) }, root .. "/compile_commands.json") == 0)
|
|
vim.cmd.edit(vim.fn.fnameescape(file))
|
|
local buf = vim.api.nvim_get_current_buf()
|
|
vim.bo[buf].filetype = "cpp"
|
|
local id = assert(vim.lsp.start({
|
|
name = "VoidLanguageServer",
|
|
cmd = { server, "--stdio", "--workspace-root", root, "--provider", "compdb", "--gcc-profile", profile_path },
|
|
root_dir = root,
|
|
flags = { debounce_text_changes = 10 },
|
|
}, { bufnr = buf }))
|
|
client = assert(vim.lsp.get_client_by_id(id))
|
|
wait_for("initialization", function() return client.initialized end)
|
|
local params = { textDocument = { uri = vim.uri_from_bufnr(buf) }, workspaceUri = vim.uri_from_fname(root) }
|
|
local reply = assert(client:request_sync("voidLanguageServer/providerStatus", params, 5000, buf))
|
|
assert(not reply.err and reply.result.state == "ready" and reply.result.contextCount == 1,
|
|
vim.inspect(reply))
|
|
assert(reply.result.selected.owningTu == params.textDocument.uri)
|
|
local start = assert(original:find("value", 1, true)) - 1
|
|
vim.api.nvim_buf_set_text(buf, 1, start, 1, start + 5, { "missing" })
|
|
wait_for("stock compiler diagnosis", function()
|
|
for _, d in ipairs(vim.diagnostic.get(buf)) do
|
|
if d.source == "gcc" and d.message:find("missing", 1, true) and d.lnum == 1
|
|
and d.col == start and d.end_col == start + 7 then return true end
|
|
end
|
|
end)
|
|
vim.api.nvim_buf_set_text(buf, 1, start, 1, start + 7, { "value" })
|
|
wait_for("diagnostic clear", function() return #vim.diagnostic.get(buf) == 0 end)
|
|
assert(vim.fn.readfile(file)[2] == original)
|
|
end
|
|
|
|
local ok, err = xpcall(run, debug.traceback)
|
|
if client then
|
|
client:stop()
|
|
if not vim.wait(5000, function() return client:is_stopped() end) then client:stop(true) end
|
|
end
|
|
vim.fn.delete(root, "rf")
|
|
assert(ok, err)
|
|
print("Neovim LSP passed: selected compile command, seven-byte stock GCC diagnostic and clear")
|