internal/lsp: create the undelivered map
(for real, this time) Change-Id: I563b7b34a1849914e9b922b07a86916bac7be30d Reviewed-on: https://go-review.googlesource.com/c/tools/+/170183 Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
parent
4fc9f0bfa5
commit
bf99c0974b
|
@ -32,6 +32,9 @@ func (s *Server) cacheAndDiagnose(ctx context.Context, uri span.URI, content str
|
||||||
|
|
||||||
for uri, diagnostics := range reports {
|
for uri, diagnostics := range reports {
|
||||||
if err := s.publishDiagnostics(ctx, uri, diagnostics); err != nil {
|
if err := s.publishDiagnostics(ctx, uri, diagnostics); err != nil {
|
||||||
|
if s.undelivered == nil {
|
||||||
|
s.undelivered = make(map[span.URI][]source.Diagnostic)
|
||||||
|
}
|
||||||
s.undelivered[uri] = diagnostics
|
s.undelivered[uri] = diagnostics
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,8 @@ func testLSP(t *testing.T, exporter packagestest.Exporter) {
|
||||||
|
|
||||||
log := xlog.New(xlog.StdSink{})
|
log := xlog.New(xlog.StdSink{})
|
||||||
s := &Server{
|
s := &Server{
|
||||||
view: cache.NewView(ctx, log, "lsp_test", span.FileURI(cfg.Dir), &cfg),
|
view: cache.NewView(ctx, log, "lsp_test", span.FileURI(cfg.Dir), &cfg),
|
||||||
|
undelivered: make(map[span.URI][]source.Diagnostic),
|
||||||
}
|
}
|
||||||
// Do a first pass to collect special markers for completion.
|
// Do a first pass to collect special markers for completion.
|
||||||
if err := exported.Expect(map[string]interface{}{
|
if err := exported.Expect(map[string]interface{}{
|
||||||
|
|
Loading…
Reference in New Issue