blob: 2972694d085698c7da9cc92e200b3190aba11b3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
local files = require 'files'
local define = require 'proto.define'
local config = require 'config'
local function check(uri, name, level, results)
if config.config.diagnostics.disable[name] then
return
end
level = config.config.diagnostics.severity[name] or level
local severity = define.DiagnosticSeverity[level]
require('core.diagnostics.' .. name)(uri, function (result)
result.level = severity or result.level
result.code = name
results[#results+1] = result
end, name)
end
return function (uri)
local ast = files.getAst(uri)
if not ast then
return nil
end
local results = {}
for name, level in pairs(define.DiagnosticDefaultSeverity) do
check(uri, name, level, results)
end
return results
end
|