diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-07-05 19:47:15 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-07-05 19:47:15 +0800 |
commit | 2ab618716a33378449aa4938864db632a141719e (patch) | |
tree | 56b141d4b3439b5136d988908fc08b2b5838146e /script/proto/diagnostic.lua | |
parent | 671c7089a1697ee8f6fc108a9568b0509e1aa933 (diff) | |
download | lua-language-server-2ab618716a33378449aa4938864db632a141719e.zip |
resolve #1254 can suppress syntax errors
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 |