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.
69 lines
3.0 KiB
Lua
69 lines
3.0 KiB
Lua
-- Run with nvim --headless -u NONE -i NONE -l tests/native/NeovimReplay.lua.
|
|
local plugin = assert(vim.env.VLS_NVIM_DAP, "set VLS_NVIM_DAP to the nvim-dap checkout")
|
|
local adapter = assert(vim.env.VLS_DAP, "set VLS_DAP to the adapter executable")
|
|
local trace = assert(vim.env.VLS_TRACE, "set VLS_TRACE to integral-17.vls")
|
|
vim.opt.runtimepath:prepend(plugin)
|
|
local dap = require("dap")
|
|
|
|
dap.adapters.vls = { type = "executable", command = adapter, args = { "--replay", trace } }
|
|
local stops = 0
|
|
dap.listeners.after.event_stopped.vls_test = function(_, event)
|
|
assert(event.threadId == 1)
|
|
stops = stops + 1
|
|
end
|
|
|
|
local function wait_for(label, predicate)
|
|
assert(vim.wait(5000, predicate, 10), "timed out waiting for " .. label)
|
|
end
|
|
|
|
local function request(session, method, args)
|
|
local done, err, body = false, nil, nil
|
|
session:request(method, args, function(problem, result)
|
|
err, body, done = problem, result, true
|
|
end)
|
|
wait_for(method, function() return done end)
|
|
assert(not err, vim.inspect(err))
|
|
return body
|
|
end
|
|
|
|
local function read_value(session)
|
|
local stack = request(session, "stackTrace", { threadId = 1 })
|
|
local frame = assert(stack.stackFrames[1])
|
|
assert(not frame.source and frame.line == 0)
|
|
local scope = request(session, "scopes", { frameId = frame.id }).scopes[1]
|
|
local reply = request(session, "variables", { variablesReference = scope.variablesReference })
|
|
for _, var in ipairs(reply.variables) do
|
|
if var.name == "Result" then return var.value, frame.name end
|
|
end
|
|
error("recorded result is missing")
|
|
end
|
|
|
|
dap.run({ type = "vls", name = "C++ constant evaluation", request = "launch" })
|
|
wait_for("first stop", function()
|
|
return stops == 1 and dap.session() and dap.session().stopped_thread_id == 1
|
|
end)
|
|
local session = assert(dap.session())
|
|
local value, name = read_value(session)
|
|
assert(value == "17" and name == "reflected_value")
|
|
local first = request(session, "vls/session")
|
|
local query = { schemaVersion = first.schemaVersion, sessionId = first.sessionId,
|
|
generation = first.generation, start = 5, count = 4 }
|
|
local page = request(session, "vls/timeline", query)
|
|
assert(page.events[3].acknowledgedAction == "step" and page.events[3].acknowledgedStop == 6)
|
|
local source = request(session, "source", { sourceReference = first.sourceReference })
|
|
assert(vim.fn.sha256(source.content) == first.sourceSha256)
|
|
dap.continue()
|
|
wait_for("outer return", function() return stops == 2 and session.stopped_thread_id == 1 end)
|
|
value, name = read_value(session)
|
|
assert(value == "34" and name == "twice")
|
|
local second = request(session, "vls/session")
|
|
assert(second.sessionId == first.sessionId and second.eventSequence == 10)
|
|
assert(second.generation > first.generation)
|
|
local disconnected = false
|
|
session:disconnect({}, function(err)
|
|
assert(not err, vim.inspect(err))
|
|
disconnected = true
|
|
end)
|
|
wait_for("disconnect", function() return disconnected and dap.session() == nil end)
|
|
print("Neovim replay passed: reflected_value=17, twice=34, captured source and acknowledged timeline")
|