summaryrefslogtreecommitdiff
path: root/script/provider/diagnostic.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-05-28 01:35:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-05-28 01:40:41 +0800
commit3f32e2fcaf03ecbf393af138e2eb8b63e92521bd (patch)
treed9741f707f8421d10a6ed4e5a9928e101997fcbd /script/provider/diagnostic.lua
parent6185d71449048178faa98e427db82675c70fc4a3 (diff)
downloadlua-language-server-3f32e2fcaf03ecbf393af138e2eb8b63e92521bd.zip
use `pull diagnostic` for diag opened files
Diffstat (limited to 'script/provider/diagnostic.lua')
-rw-r--r--script/provider/diagnostic.lua36
1 files changed, 6 insertions, 30 deletions
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua
index 8b4240f3..076a613e 100644
--- a/script/provider/diagnostic.lua
+++ b/script/provider/diagnostic.lua
@@ -532,18 +532,6 @@ function m.pullDiagnosticScope(callback)
end
end
----@param uri uri
----@return 'server' | 'client'
-function m.getOwner(uri)
- -- TODO
- do return 'server' end
- if PREVIEW then
- return 'client'
- else
- return 'server'
- end
-end
-
function m.refreshClient()
log.debug('Refresh client diagnostics')
proto.request('workspace/diagnostic/refresh', json.null)
@@ -551,18 +539,12 @@ end
ws.watch(function (ev, uri)
if ev == 'reload' then
- if m.getOwner(uri) == 'server' then
- m.diagnosticsScope(uri)
- else
- m.refreshClient()
- end
+ m.diagnosticsScope(uri)
+ m.refreshClient()
end
end)
files.watch(function (ev, uri) ---@async
- if m.getOwner(uri) == 'client' then
- return
- end
if ev == 'remove' then
m.clear(uri)
m.refresh(uri)
@@ -584,11 +566,8 @@ end)
config.watch(function (uri, key, value, oldValue)
if key:find 'Lua.diagnostics' then
if value ~= oldValue then
- if m.getOwner(uri) == 'server' then
- m.diagnosticsScope(uri)
- else
- m.refreshClient()
- end
+ m.diagnosticsScope(uri)
+ m.refreshClient()
end
end
end)
@@ -596,11 +575,8 @@ end)
fw.event(function (ev, path)
if util.stringEndWith(path, '.editorconfig') then
for _, scp in ipairs(ws.folders) do
- if m.getOwner(scp.uri) == 'server' then
- m.diagnosticsScope(scp.uri)
- else
- m.refreshClient()
- end
+ m.diagnosticsScope(scp.uri)
+ m.refreshClient()
end
end
end)