internal/lsp: log when we fail to type-check a package
Change-Id: I07a0a224359b698e50da8496b21634d8bd947aa9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/178277
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
diff --git a/internal/lsp/cache/file.go b/internal/lsp/cache/file.go
index bd8fb05..14bb7f5 100644
--- a/internal/lsp/cache/file.go
+++ b/internal/lsp/cache/file.go
@@ -89,6 +89,7 @@
defer f.view.mu.Unlock()
if f.token == nil || len(f.view.contentChanges) > 0 {
if _, err := f.view.parse(ctx, f); err != nil {
+ f.View().Session().Logger().Errorf(ctx, "unable to check package for %s: %v", f.URI(), err)
return nil
}
}
@@ -101,6 +102,7 @@
if f.ast == nil || len(f.view.contentChanges) > 0 {
if _, err := f.view.parse(ctx, f); err != nil {
+ f.View().Session().Logger().Errorf(ctx, "unable to check package for %s: %v", f.URI(), err)
return nil
}
}
@@ -113,6 +115,8 @@
if f.pkg == nil || len(f.view.contentChanges) > 0 {
if errs, err := f.view.parse(ctx, f); err != nil {
+ f.View().Session().Logger().Errorf(ctx, "unable to check package for %s: %v", f.URI(), err)
+
// Create diagnostics for errors if we are able to.
if len(errs) > 0 {
return &pkg{errors: errs}
diff --git a/internal/lsp/info.1.11.go b/internal/lsp/info.1.11.go
index cd24339..ac4128f 100644
--- a/internal/lsp/info.1.11.go
+++ b/internal/lsp/info.1.11.go
@@ -12,5 +12,5 @@
)
func printBuildInfo(w io.Writer, verbose bool) {
- fmt.Fprintf(w, "no module information, gopls not build with go 1.11 or earlier\n")
+ fmt.Fprintf(w, "no module information, gopls not built with go 1.11 or earlier\n")
}