add a dummy cancelRequest implementation (#790)

This commit is contained in:
Techatrix 2022-12-01 10:00:08 +01:00 committed by GitHub
parent c3256c00e7
commit 784047d952
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1769,6 +1769,13 @@ fn exitHandler(server: *Server, writer: anytype, id: types.RequestId) noreturn {
std.os.exit(error_code); std.os.exit(error_code);
} }
fn cancelRequestHandler(server: *Server, writer: anytype, id: types.RequestId) !void {
_ = id;
_ = writer;
_ = server;
// TODO implement $/cancelRequest
}
fn registerCapability(server: *Server, writer: anytype, method: []const u8) !void { fn registerCapability(server: *Server, writer: anytype, method: []const u8) !void {
const id = try std.fmt.allocPrint(server.arena.allocator(), "register-{s}", .{method}); const id = try std.fmt.allocPrint(server.arena.allocator(), "register-{s}", .{method});
log.debug("Dynamically registering method '{s}'", .{method}); log.debug("Dynamically registering method '{s}'", .{method});
@ -2869,10 +2876,10 @@ pub fn processJsonRpc(server: *Server, writer: anytype, json: []const u8) !void
const method_map = .{ const method_map = .{
.{ "initialized", void, initializedHandler }, .{ "initialized", void, initializedHandler },
.{"$/cancelRequest"},
.{ "initialize", requests.Initialize, initializeHandler }, .{ "initialize", requests.Initialize, initializeHandler },
.{ "shutdown", void, shutdownHandler }, .{ "shutdown", void, shutdownHandler },
.{ "exit", void, exitHandler }, .{ "exit", void, exitHandler },
.{ "$/cancelRequest", void, cancelRequestHandler },
.{ "textDocument/didOpen", requests.OpenDocument, openDocumentHandler }, .{ "textDocument/didOpen", requests.OpenDocument, openDocumentHandler },
.{ "textDocument/didChange", requests.ChangeDocument, changeDocumentHandler }, .{ "textDocument/didChange", requests.ChangeDocument, changeDocumentHandler },
.{ "textDocument/didSave", requests.SaveDocument, saveDocumentHandler }, .{ "textDocument/didSave", requests.SaveDocument, saveDocumentHandler },