Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/lsp-core/src/lsp/fixtures/workspace-edit-server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ function handleNotification(message) {
}
if (message.method === "textDocument/didOpen") {
applyPublishSteps("didOpen", message.params.textDocument.uri, message.params.textDocument.version);
if (scenario.unscopedApplyEditOnDidOpen) {
sendApplyEdit(scenario.unscopedApplyEditOnDidOpen, { kind: "unscoped" });
}
}
if (message.method === "textDocument/didChange" && Array.isArray(scenario.diagnostics)) {
send({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
readEvents,
renameTextEdit,
waitForEventCount,
waitForEventCountBySubscription,
} from "./workspace-apply-edit-test-support.js";

const harness = createWorkspaceEditTestHarness();
Expand All @@ -17,13 +18,16 @@ afterEach(async () => {

describe("LspClient workspace mutation lease", () => {
it("#given no mutating request #when the server calls applyEdit #then the request is rejected as unscoped", async () => {
const context = await harness.makeClient({ unscopedApplyEdit: renameTextEdit("before", "after", { version: 1 }) });

const responses = await waitForEventCount(
const context = await harness.makeClient({
unscopedApplyEditOnDidOpen: renameTextEdit("before", "after", { version: 1 }),
});
const response = waitForEventCountBySubscription(
context.events,
(event) => event.type === "clientResponse" && event.method === "workspace/applyEdit",
1,
);
await context.client.openFile(context.source);
const responses = await response;

expect(responses[0]?.result).toEqual({
applied: false,
Expand Down
Loading