summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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()