summaryrefslogtreecommitdiff
path: root/test/behaviour
diff options
context:
space:
mode:
Diffstat (limited to 'test/behaviour')
-rw-r--r--test/behaviour/language_servers.zig25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/behaviour/language_servers.zig b/test/behaviour/language_servers.zig
index 904fcfba..13e42fa6 100644
--- a/test/behaviour/language_servers.zig
+++ b/test/behaviour/language_servers.zig
@@ -298,3 +298,28 @@ test "language-servers: Index runs the language's indexer at the project's root,
const dir = buf[0..try tmp.dir.realPath(std.testing.io, &buf)];
try std.testing.expect(std.mem.startsWith(u8, try bodyOf(&s, dir), s.at("% cd '{s}' && rust-analyzer scip .", .{dir})));
}
+
+test "language-servers: SPC l a lists the server's code actions in the pane's tag by their digits, the one under the cursor shown as its edit, and its digit applies it, one the server left to resolve resolved first" {
+ var tmp = std.testing.tmpDir(.{});
+ defer tmp.cleanup();
+ var s = try Session.initLanguage(std.testing.allocator);
+ defer s.deinit();
+ const before = "mod lib;\n\nfn main() {\n let x = add(1, 2);\n let y = add(3, 4);\n let _ = x + y;\n}\n";
+ try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "main.rs", .data = before });
+ var buf: [4096]u8 = undefined;
+ const main = try s.lookFile(s.at("{s}/main.rs:4:13", .{buf[0..try tmp.dir.realPath(std.testing.io, &buf)]}));
+ const body = s.at("/pane/{d}/body", .{main});
+ try s.keys(" la");
+ try std.testing.expect(std.mem.indexOf(u8, try s.read("/index"), "+Lsp") == null);
+ _ = try s.where("▶ 1 mock action: extract");
+ _ = try s.where(" 2 mock action: add a line");
+ _ = try s.where(" 3 mock action: rename add to sum");
+ // The third, its edit asked for with codeAction/resolve: the two calls.
+ try s.keys("\u{F800}\u{F800}");
+ _ = try s.where("let x = sum(1, 2);");
+ try s.expect(body, before);
+ try s.keys("3");
+ try s.expect(body, "mod lib;\n\nfn main() {\n let x = sum(1, 2);\n let y = sum(3, 4);\n let _ = x + y;\n}\n");
+ try s.keys("u");
+ try s.expect(body, before);
+}