зеркало из https://github.com/golang/tools.git
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:
Родитель
90c8b4f75b
Коммит
379209517f
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче