diff options
Diffstat (limited to 'script/proto/diagnostic.lua')
-rw-r--r-- | script/proto/diagnostic.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/script/proto/diagnostic.lua b/script/proto/diagnostic.lua index 1065950d..e5f74ef5 100644 --- a/script/proto/diagnostic.lua +++ b/script/proto/diagnostic.lua @@ -236,4 +236,31 @@ m.getGroups = util.cacheReturn(function (name) return groups end) +---@return table<string, true> +function m.getDiagAndErrNameMap() + if not m._diagAndErrNames then + local names = {} + for name in pairs(m.getDefaultSeverity()) do + names[name] = true + end + local path = package.searchpath('parser.compile', package.path) + if path then + local f = io.open(path) + if f then + for line in f:lines() do + local name = line:match([=[type%s*=%s*['"](%u[%u_]+%u)['"]]=]) + if name then + local id = name:lower():gsub('_', '-') + names[id] = true + end + end + f:close() + end + end + table.sort(names) + m._diagAndErrNames = names + end + return m._diagAndErrNames +end + return m |