From f09ffb63dbce3314e1be7059831e5a81e43eea2c Mon Sep 17 00:00:00 2001 From: Techatrix <19954306+Techatrix@users.noreply.github.com> Date: Sat, 19 Nov 2022 00:49:59 +0100 Subject: [PATCH] don't format files with syntax errors (#766) * don't format files with syntax errors * Remove showMessage Co-authored-by: Auguste Rame <19855629+SuperAuguste@users.noreply.github.com> --- src/Server.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Server.zig b/src/Server.zig index d8de20e..3a439ce 100644 --- a/src/Server.zig +++ b/src/Server.zig @@ -2098,6 +2098,10 @@ fn formattingHandler(server: *Server, writer: anytype, id: types.RequestId, req: return try respondGeneric(writer, id, null_result_response); }; + if (handle.tree.errors.len != 0) { + return try respondGeneric(writer, id, null_result_response); + } + const formatted = try handle.tree.render(server.allocator); defer server.allocator.free(formatted);