test(lsp): read the answer of a request by its id, not by its place in the batch #356
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/244-response-to"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #244
What
responseTo(var server, messages, id)incompiler/tests/language-server.test.trb: returns the one response with thatidfrom the batch, ignoring notifications (publishDiagnostics,logMessage, ...) and requests of the server; prints the batch and fails when there is not exactly one.onlynow usesresponseTowith the request id (hover, definition, completion, resolve, rename, code action, semantic tokens,torbscript/tests, the sliced-check hover).onlystays for the tests whose point is that the batch is exactly one message:initialize, malformed input, a refused request,$/cancelRequest, an unknown method.Hover > the answer is found by its id, whatever notifications share its batch: a batch with thepublishDiagnosticsof an opened document and a hover answer is answered byresponseTowith the hover result.started()keepscheckBudget = Int.maximumand its comment.Why
A later change that lets a notification share a batch with a response would turn the
onlytests into random reds again with a misleading message; selecting the answer by id removes that class.Seed impact
None: one test file, no syntax, native, driver flag or std name.
Test
sh tools/gates.sh ain the forge CI of this PR (test count +1).tools/check-commits.sh origin/main HEADclean locally.c8dc3424bfa158a33e9fa158a33e9fb0410e55caApproved at
b0410e5.responseToselects the single response by id (nomethod, matchingid) and prints the batch when the count is not one. The migrated tests (hover, definition, completion, resolve, rename, code action, semantic tokens,torbscript/tests, sliced-check hover) each pass the id of their request. The new test builds a batch with thepublishDiagnosticsof the opened document plus the hover answer, asserts the batch holds more than one message, and reads the hover result by id. CI is green for this head (tier A, gates, bootstrap).onlycalls whose point is a batch of exactly one message remain (refused request, unknown method, malformed input,$/cancelRequest,initialize). The two remaining positional reads are batches without a request or a deliberate order check.started()keepscheckBudget = Int.maximum.Non-blocking: none.