Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit aa273e3

Browse files
fix: 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 aa273e3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

‎changelog.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44
<!-- Add all new changes here. They will be moved under a version at release -->
5+
* `FIX` prevent unnecessary edits by LSP formatting when content did not change
56

67
## 3.13.9
78
`2025年3月13日`

‎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)

AltStyle によって変換されたページ (->オリジナル) /