Remove format lt 512 diff restriction (#1109)

This commit is contained in:
Auguste Rame 2023-04-04 16:23:44 -04:00 committed by GitHub
parent 0f85c49e46
commit 7814a05921
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -935,15 +935,6 @@ pub fn formattingHandler(server: *Server, request: types.DocumentFormattingParam
if (std.mem.eql(u8, handle.text, formatted)) return null;
if (formatted.len <= 512) {
var text_edits = try allocator.alloc(types.TextEdit, 1);
text_edits[0] = .{
.range = offsets.locToRange(handle.text, .{ .start = 0, .end = handle.text.len }, server.offset_encoding),
.newText = formatted,
};
return text_edits;
}
return if (diff.edits(allocator, handle.text, formatted, server.offset_encoding)) |text_edits| text_edits.items else |_| null;
}