aboutsummaryrefslogtreecommitdiff
path: root/internal/lsp/references.go
diff options
context:
space:
mode:
authorRebecca Stambler <rstambler@golang.org>2019-11-15 12:43:45 -0500
committerRebecca Stambler <rstambler@golang.org>2019-11-16 21:44:31 +0000
commit80313e1ba7181ff88576941b25b4beb004e348db (patch)
tree7cd6f85924e2e11d549b08ce0c4de80b7048c1d6 /internal/lsp/references.go
parent3a792d9c32b2634e09d90a8e377b8f77fca8f02a (diff)
downloadgolang-x-tools-80313e1ba7181ff88576941b25b4beb004e348db.tar.gz
internal/lsp: fix panic in bestView
Rather than panicking when we have not created any views for the packages, we should show a reasonable error to the user. This change propagates the errors to the user. Updates golang/go#35599 Change-Id: I49789d8ce18e154f111bc3584488f468a129e30c Reviewed-on: https://go-review.googlesource.com/c/tools/+/207344 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org>
Diffstat (limited to 'internal/lsp/references.go')
-rw-r--r--internal/lsp/references.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/lsp/references.go b/internal/lsp/references.go
index 6930a6c17..a29203551 100644
--- a/internal/lsp/references.go
+++ b/internal/lsp/references.go
@@ -16,7 +16,10 @@ import (
func (s *Server) references(ctx context.Context, params *protocol.ReferenceParams) ([]protocol.Location, error) {
uri := span.NewURI(params.TextDocument.URI)
- view := s.session.ViewOf(uri)
+ view, err := s.session.ViewOf(uri)
+ if err != nil {
+ return nil, err
+ }
f, err := view.GetFile(ctx, uri)
if err != nil {
return nil, err