Skip to content

Commit 7ea9e7c

Browse files
feat: return empty response to textDocument/formatting if no changes
Do not send "edits" if the content remains unchanged after LSP formatting. Otherwise, Neovim reports an unsaved buffer even when no actual changes were made
1 parent 802e13c commit 7ea9e7c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

script/core/formatting.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ return function(uri, options)
2121
return
2222
end
2323

24+
if text == formattedText then
25+
return
26+
end
27+
2428
return {
2529
{
2630
start = state.ast.start,

0 commit comments

Comments
 (0)