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/provider | |
parent | 671c7089a1697ee8f6fc108a9568b0509e1aa933 (diff) | |
download | lua-language-server-2ab618716a33378449aa4938864db632a141719e.zip |
resolve #1254 can suppress syntax errors
Diffstat (limited to 'script/provider')
-rw-r--r-- | script/provider/diagnostic.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua index c3822087..58940d2e 100644 --- a/script/provider/diagnostic.lua +++ b/script/provider/diagnostic.lua @@ -17,6 +17,7 @@ local ltable = require 'linked-table' local furi = require 'file-uri' local json = require 'json' local fw = require 'filewatch' +local vm = require 'vm.vm' ---@class diagnosticProvider local m = {} @@ -193,7 +194,9 @@ function m.syntaxErrors(uri, ast) pcall(function () local disables = util.arrayToHash(config.get(uri, 'Lua.diagnostics.disable')) for _, err in ipairs(ast.errs) do - if not disables[err.type:lower():gsub('_', '-')] then + local id = err.type:lower():gsub('_', '-') + if not disables[id] + and not vm.isDiagDisabledAt(uri, err.start, id, true) then results[#results+1] = buildSyntaxError(uri, err) end end |