diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-24 15:54:38 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-24 15:54:38 +0800 |
commit | cf4e49ba82484254cfe2a74b12e340575324c80c (patch) | |
tree | 2962523579c9f6bb3c74dc560f17bae3359b9e08 /script/proto | |
parent | 2738409e2d6d54253f48140533980f433d02efa3 (diff) | |
download | lua-language-server-cf4e49ba82484254cfe2a74b12e340575324c80c.zip |
diagnostic group
Diffstat (limited to 'script/proto')
-rw-r--r-- | script/proto/define.lua | 6 | ||||
-rw-r--r-- | script/proto/diagnostic.lua | 15 |
2 files changed, 21 insertions, 0 deletions
diff --git a/script/proto/define.lua b/script/proto/define.lua index 93907847..c73203f5 100644 --- a/script/proto/define.lua +++ b/script/proto/define.lua @@ -10,6 +10,12 @@ m.DiagnosticSeverity = { Hint = 4, } +m.DiagnosticFileStatus = { + Any = 1, + Opened = 2, + None = 3, +} + --- 诊断类型与默认等级 m.DiagnosticDefaultSeverity = diag.getDefaultSeverity() diff --git a/script/proto/diagnostic.lua b/script/proto/diagnostic.lua index cba6a493..d8bac443 100644 --- a/script/proto/diagnostic.lua +++ b/script/proto/diagnostic.lua @@ -1,3 +1,5 @@ +local util = require 'utility' + ---@class proto.diagnostic local m = {} @@ -217,4 +219,17 @@ function m.getGroupStatus() return group end +---@param name string +---@return string[] +m.getGroups = util.catchReturn(function (name) + local groups = {} + for groupName, nameMap in pairs(m.diagnosticGroups) do + if nameMap[name] then + groups[#groups+1] = groupName + end + end + table.sort(groups) + return groups +end) + return m |