internal/lsp: add back check that a package was found for a given file
Added this check in golang.org/cl/161077 and unintentionally removed it in golang.org/cl/161497. Change-Id: I66bd2b616f4b41c25f134f6e9457c97bbcd3f72b Reviewed-on: https://go-review.googlesource.com/c/162398 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
dbb4d4be53
commit
740235f6c0
|
@ -121,6 +121,7 @@ func (v *View) parse(uri source.URI) error {
|
|||
}
|
||||
return err
|
||||
}
|
||||
var foundPkg bool // true if we found the package for uri
|
||||
for _, pkg := range pkgs {
|
||||
imp := &importer{
|
||||
entries: make(map[string]*entry),
|
||||
|
@ -150,12 +151,18 @@ func (v *View) parse(uri source.URI) error {
|
|||
continue
|
||||
}
|
||||
fURI := source.ToURI(tok.Name())
|
||||
if fURI == uri {
|
||||
foundPkg = true
|
||||
}
|
||||
f := imp.v.getFile(fURI)
|
||||
f.token = tok
|
||||
f.ast = file
|
||||
f.pkg = pkg
|
||||
}
|
||||
}
|
||||
if !foundPkg {
|
||||
return fmt.Errorf("no package found for %v", uri)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue