summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-23 17:50:11 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-23 17:50:11 +0800
commit2bcd7495aad00ffc47fc96e8cf801e52e7452a83 (patch)
treed362bdcb50f065d9bf0df84d2d985b6c8ef85289
parent61d9a99cb32487defbf72486d079e9c7324e4e51 (diff)
downloadlua-language-server-2bcd7495aad00ffc47fc96e8cf801e52e7452a83.zip
fix workspace diags
-rw-r--r--changelog.md1
-rw-r--r--script/provider/diagnostic.lua19
2 files changed, 13 insertions, 7 deletions
diff --git a/changelog.md b/changelog.md
index 15d69ff9..a06908d2 100644
--- a/changelog.md
+++ b/changelog.md
@@ -24,6 +24,7 @@
local n3 = f(0, 0) -- `n3` is `string`
```
* `FIX` diagnostics flash when opening a file
+* `FIX` sometimes workspace diagnostics are not triggered
* `FIX` [#1228](https://github.com/sumneko/lua-language-server/issues/1228)
## 3.3.1
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua
index 713d4f48..a5a1b527 100644
--- a/script/provider/diagnostic.lua
+++ b/script/provider/diagnostic.lua
@@ -378,20 +378,25 @@ function m.pullDiagnostic(uri, isScopeDiag)
return full
end
+---@param uri uri
function m.refresh(uri)
if not ws.isReady(uri) then
return
end
+
+ await.close('diag:' .. uri)
+ ---@async
+ await.call(function ()
+ await.setID('diag:' .. uri)
+ await.sleep(0.1)
+ xpcall(m.doDiagnostic, log.error, uri)
+ end)
+
local scp = scope.getScope(uri)
local scopeID = 'diagnosticsScope:' .. scp:getName()
- await.close('diag:' .. uri)
await.close(scopeID)
- await.call(function () ---@async
- if uri then
- await.setID('diag:' .. uri)
- await.sleep(0.1)
- xpcall(m.doDiagnostic, log.error, uri)
- end
+ ---@async
+ await.call(function ()
local delay = config.get(uri, 'Lua.diagnostics.workspaceDelay') / 1000
if delay < 0 then
return