mirror of
https://github.com/golang/go
synced 2024-11-18 19:24:39 -07:00
internal/lsp: add additional logging for go/packages failures
Change-Id: I8c6dae4309df1746cd8b74d280f1f360f42cc77b Reviewed-on: https://go-review.googlesource.com/c/161218 Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
parent
90c8b4f75b
commit
379209517f
9
internal/lsp/cache/view.go
vendored
9
internal/lsp/cache/view.go
vendored
@ -8,6 +8,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"go/token"
|
||||
"log"
|
||||
"sync"
|
||||
|
||||
"golang.org/x/tools/go/packages"
|
||||
@ -112,7 +113,15 @@ func (v *View) parse(uri source.URI) error {
|
||||
// Add every file in this package to our cache.
|
||||
for _, fAST := range pkg.Syntax {
|
||||
// TODO: If a file is in multiple packages, which package do we store?
|
||||
if !fAST.Pos().IsValid() {
|
||||
log.Printf("invalid position for AST %v", fAST.Name)
|
||||
continue
|
||||
}
|
||||
fToken := v.Config.Fset.File(fAST.Pos())
|
||||
if fToken == nil {
|
||||
log.Printf("no token.File for %v", fAST.Name)
|
||||
continue
|
||||
}
|
||||
fURI := source.ToURI(fToken.Name())
|
||||
f := v.getFile(fURI)
|
||||
f.token = fToken
|
||||
|
Loading…
Reference in New Issue
Block a user