Skip to content

Commit 02d43a5

Browse files
committed
try to abort incorrect formatting
#2062
1 parent 8d88cec commit 02d43a5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

script/provider/provider.lua

+7
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,7 @@ m.register 'textDocument/formatting' {
12261226
capability = {
12271227
documentFormattingProvider = true,
12281228
},
1229+
abortByFileUpdate = true,
12291230
---@async
12301231
function(params)
12311232
local uri = files.getRealUri(params.textDocument.uri)
@@ -1256,6 +1257,8 @@ m.register 'textDocument/formatting' {
12561257
}
12571258
end
12581259

1260+
await.sleep(0.1)
1261+
12591262
return results
12601263
end
12611264
}
@@ -1264,6 +1267,7 @@ m.register 'textDocument/rangeFormatting' {
12641267
capability = {
12651268
documentRangeFormattingProvider = true,
12661269
},
1270+
abortByFileUpdate = true,
12671271
---@async
12681272
function(params)
12691273
local uri = files.getRealUri(params.textDocument.uri)
@@ -1294,6 +1298,8 @@ m.register 'textDocument/rangeFormatting' {
12941298
}
12951299
end
12961300

1301+
await.sleep(0.1)
1302+
12971303
return results
12981304
end
12991305
}
@@ -1333,6 +1339,7 @@ m.register 'textDocument/onTypeFormatting' {
13331339
newText = edit.text:gsub('\t', tab),
13341340
}
13351341
end
1342+
await.sleep(0.1)
13361343
return results
13371344
end
13381345
}

0 commit comments

Comments
 (0)