summaryrefslogtreecommitdiff
path: root/script/provider/provider.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-04-26 10:25:36 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-04-26 10:25:36 +0800
commit02d43a59203e1d04aaaae3eacdaae5110da6b06d (patch)
tree194d80655a7e91d97e9c8085f43c2ad396e7c9d3 /script/provider/provider.lua
parent8d88cec860af5a594d120ab4e37d4cb47ac1f238 (diff)
downloadlua-language-server-02d43a59203e1d04aaaae3eacdaae5110da6b06d.zip
try to abort incorrect formatting
#2062
Diffstat (limited to 'script/provider/provider.lua')
-rw-r--r--script/provider/provider.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 2e6d8f75..048cf1e0 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -1226,6 +1226,7 @@ m.register 'textDocument/formatting' {
capability = {
documentFormattingProvider = true,
},
+ abortByFileUpdate = true,
---@async
function(params)
local uri = files.getRealUri(params.textDocument.uri)
@@ -1256,6 +1257,8 @@ m.register 'textDocument/formatting' {
}
end
+ await.sleep(0.1)
+
return results
end
}
@@ -1264,6 +1267,7 @@ m.register 'textDocument/rangeFormatting' {
capability = {
documentRangeFormattingProvider = true,
},
+ abortByFileUpdate = true,
---@async
function(params)
local uri = files.getRealUri(params.textDocument.uri)
@@ -1294,6 +1298,8 @@ m.register 'textDocument/rangeFormatting' {
}
end
+ await.sleep(0.1)
+
return results
end
}
@@ -1333,6 +1339,7 @@ m.register 'textDocument/onTypeFormatting' {
newText = edit.text:gsub('\t', tab),
}
end
+ await.sleep(0.1)
return results
end
}