Fix raw, responseless returns on willSaveWaitUntil (#833)

* Fix raw, responseless returns on willSaveWaitUntil

* Make this code pretty
This commit is contained in:
Auguste Rame 2022-12-19 16:01:08 -05:00 committed by GitHub
parent 7b0c2a34fc
commit c355a54dd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1879,14 +1879,16 @@ fn willSaveWaitUntilHandler(server: *Server, writer: anytype, id: types.RequestI
const tracy_zone = tracy.trace(@src()); const tracy_zone = tracy.trace(@src());
defer tracy_zone.end(); defer tracy_zone.end();
if (!server.config.enable_ast_check_diagnostics) return;
if (!server.config.enable_autofix) return;
const allocator = server.arena.allocator(); const allocator = server.arena.allocator();
b: {
if (!server.config.enable_ast_check_diagnostics or !server.config.enable_autofix)
break :b;
const uri = req.params.textDocument.uri; const uri = req.params.textDocument.uri;
const handle = server.document_store.getHandle(uri) orelse return; const handle = server.document_store.getHandle(uri) orelse break :b;
if (handle.tree.errors.len != 0) return; if (handle.tree.errors.len != 0) break :b;
var text_edits = try server.autofix(allocator, handle); var text_edits = try server.autofix(allocator, handle);
@ -1896,6 +1898,12 @@ fn willSaveWaitUntilHandler(server: *Server, writer: anytype, id: types.RequestI
}); });
} }
return try send(writer, allocator, types.Response{
.id = id,
.result = .{ .TextEdits = &.{} },
});
}
fn semanticTokensFullHandler(server: *Server, writer: anytype, id: types.RequestId, req: requests.SemanticTokensFull) !void { fn semanticTokensFullHandler(server: *Server, writer: anytype, id: types.RequestId, req: requests.SemanticTokensFull) !void {
const tracy_zone = tracy.trace(@src()); const tracy_zone = tracy.trace(@src());
defer tracy_zone.end(); defer tracy_zone.end();