internal/lsp: set the diagnostic source earlier
We now set the diagnostic source in the diagnostics call rather than when converting it to the LSP protocol. Change-Id: Ic762aaab1b2bf93b75c4c3d78aa84e2f918398fc Reviewed-on: https://go-review.googlesource.com/c/tools/+/172408 Run-TryBot: Ian Cottrell <iancottrell@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
49a1609436
commit
35716ff3bc
|
@ -75,10 +75,6 @@ func toProtocolDiagnostics(ctx context.Context, v source.View, diagnostics []sou
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
src := diag.Source
|
|
||||||
if src == "" {
|
|
||||||
src = "LSP"
|
|
||||||
}
|
|
||||||
var severity protocol.DiagnosticSeverity
|
var severity protocol.DiagnosticSeverity
|
||||||
switch diag.Severity {
|
switch diag.Severity {
|
||||||
case source.SeverityError:
|
case source.SeverityError:
|
||||||
|
@ -94,7 +90,7 @@ func toProtocolDiagnostics(ctx context.Context, v source.View, diagnostics []sou
|
||||||
Message: diag.Message,
|
Message: diag.Message,
|
||||||
Range: rng,
|
Range: rng,
|
||||||
Severity: severity,
|
Severity: severity,
|
||||||
Source: src,
|
Source: diag.Source,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return reports, nil
|
return reports, nil
|
||||||
|
|
|
@ -88,6 +88,7 @@ func Diagnostics(ctx context.Context, v View, uri span.URI) (map[span.URI][]Diag
|
||||||
spn = pointToSpan(ctx, v, spn)
|
spn = pointToSpan(ctx, v, spn)
|
||||||
}
|
}
|
||||||
diagnostic := Diagnostic{
|
diagnostic := Diagnostic{
|
||||||
|
Source: "LSP",
|
||||||
Span: spn,
|
Span: spn,
|
||||||
Message: diag.Msg,
|
Message: diag.Msg,
|
||||||
Severity: SeverityError,
|
Severity: SeverityError,
|
||||||
|
|
Loading…
Reference in New Issue