summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-08-18 20:48:44 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-08-18 20:48:44 +0800
commitce58034bb7df77fb295d6f47f08c296b0847bf38 (patch)
tree8e4afd0634a04e1e50bb6d971b10e0d39fcfea64 /script
parent56cc87d03267040e6c8df1e948f1dc9b4e96e3a7 (diff)
downloadlua-language-server-ce58034bb7df77fb295d6f47f08c296b0847bf38.zip
`Lua.diagnostics.libraryFiles`
Diffstat (limited to 'script')
-rw-r--r--script/config/config.lua2
-rw-r--r--script/provider/diagnostic.lua21
2 files changed, 21 insertions, 2 deletions
diff --git a/script/config/config.lua b/script/config/config.lua
index 512b954c..9d3f8085 100644
--- a/script/config/config.lua
+++ b/script/config/config.lua
@@ -166,6 +166,8 @@ local Template = {
>> util.deepCopy(define.DiagnosticDefaultNeededFileStatus),
['Lua.diagnostics.workspaceDelay'] = Type.Integer >> 0,
['Lua.diagnostics.workspaceRate'] = Type.Integer >> 100,
+ ['Lua.diagnostics.libraryFiles'] = Type.String >> 'Disable',
+ ['Lua.diagnostics.ignoredFiles'] = Type.String >> 'Disable',
['Lua.workspace.ignoreDir'] = Type.Hash(Type.String, Type.Boolean, ';'),
['Lua.workspace.ignoreSubmodules'] = Type.Boolean >> true,
['Lua.workspace.useGitIgnore'] = Type.Boolean >> true,
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua
index 7fb1bdd2..db377ea0 100644
--- a/script/provider/diagnostic.lua
+++ b/script/provider/diagnostic.lua
@@ -182,8 +182,25 @@ function m.doDiagnostic(uri)
if not config.get 'Lua.diagnostics.enable' then
return
end
- if files.isLibrary(uri) or ws.isIgnored(uri) then
- return
+ if files.isLibrary(uri) then
+ local status = config.get 'Lua.diagnostics.libraryFiles'
+ if status == 'Disable' then
+ return
+ elseif status == 'Opened' then
+ if not files.isOpen(uri) then
+ return
+ end
+ end
+ end
+ if ws.isIgnored(uri) then
+ local status = config.get 'Lua.diagnostics.ignoredFiles'
+ if status == 'Disable' then
+ return
+ elseif status == 'Opened' then
+ if not files.isOpen(uri) then
+ return
+ end
+ end
end
await.delay()