From 2ab618716a33378449aa4938864db632a141719e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 5 Jul 2022 19:47:15 +0800 Subject: resolve #1254 can suppress syntax errors --- script/provider/diagnostic.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'script/provider') 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 -- cgit v1.2.3