only send format editings when necessary

If the original document is same as the formatted one, there's no need to send the unchanged
document's content back which will make the client confused.

Signed-off-by: Tw <tw19881113@gmail.com>
This commit is contained in:
Tw 2021-11-16 16:01:23 +08:00 committed by Auguste Rame
parent 327e66c12b
commit 769fecf9c8

View File

@ -1650,6 +1650,8 @@ fn formattingHandler(arena: *std.heap.ArenaAllocator, id: types.RequestId, req:
switch (try process.wait()) {
.Exited => |code| if (code == 0) {
if (std.mem.eql(u8, handle.document.text, stdout_bytes)) return try respondGeneric(id, null_result_response);
return try send(arena, types.Response{
.id = id,
.result = .{