diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-02-09 20:20:26 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-02-09 20:20:26 +0800 |
commit | ebc8c4d7c95fd1db872fae49a979ed1b7b5b5818 (patch) | |
tree | 4fb61f363ce1adb978bc4c9304d863f1f56fc15c /script/provider | |
parent | 872334e6bec8b8b73a634f59969dd2a69d02f69d (diff) | |
download | lua-language-server-ebc8c4d7c95fd1db872fae49a979ed1b7b5b5818.zip |
display main errors first
Diffstat (limited to 'script/provider')
-rw-r--r-- | script/provider/diagnostic.lua | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua index 792412c0..52ba3f87 100644 --- a/script/provider/diagnostic.lua +++ b/script/provider/diagnostic.lua @@ -90,25 +90,34 @@ local function buildDiagnostic(uri, diag) } end -local function merge(a, b) +local function mergeSyntaxAndDiags(a, b) if not a and not b then return nil end + local count = 0 local t = {} if a then for i = 1, #a do - if #t >= 100 then - break + local severity = a[i].severity + if severity == define.DiagnosticSeverity.Hint + or severity == define.DiagnosticSeverity.Information then + t[#t+1] = a[i] + elseif count < 10000 then + count = count + 1 + t[#t+1] = a[i] end - t[#t+1] = a[i] end end if b then for i = 1, #b do - if #t >= 100 then - break + local severity = b[i].severity + if severity == define.DiagnosticSeverity.Hint + or severity == define.DiagnosticSeverity.Information then + t[#t+1] = b[i] + elseif count < 10000 then + count = count + 1 + t[#t+1] = b[i] end - t[#t+1] = b[i] end end return t @@ -191,9 +200,10 @@ function m.doDiagnostic(uri) local syntax = m.syntaxErrors(uri, ast) local diags = {} - local function pushResult() - local full = merge(syntax, diags) + tracy.ZoneBeginN 'mergeSyntaxAndDiags' + local _ <close> = tracy.ZoneEnd + local full = mergeSyntaxAndDiags(syntax, diags) if not full then m.clear(uri) return |