mirror of
https://github.com/golang/go
synced 2024-11-18 16:14:46 -07:00
internal/lsp: return context cancellation from LookupBuiltin
Change-Id: If90d111fbe89d2be445b15ec3721d48280540de9 Reviewed-on: https://go-review.googlesource.com/c/tools/+/216305 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
parent
73c4c875f0
commit
bcecb1fcc1
3
internal/lsp/cache/view.go
vendored
3
internal/lsp/cache/view.go
vendored
@ -204,6 +204,9 @@ func (v *view) LookupBuiltin(ctx context.Context, name string) (*ast.Object, err
|
||||
return nil, err
|
||||
}
|
||||
data := v.builtin.handle.Get(ctx)
|
||||
if ctx.Err() != nil {
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
if data == nil {
|
||||
return nil, errors.Errorf("unexpected nil builtin package")
|
||||
}
|
||||
|
@ -246,7 +246,9 @@ func (c *completer) formatBuiltin(cand candidate) CompletionItem {
|
||||
item.Kind = protocol.FunctionCompletion
|
||||
astObj, err := c.snapshot.View().LookupBuiltin(c.ctx, obj.Name())
|
||||
if err != nil {
|
||||
log.Error(c.ctx, "no builtin package", err)
|
||||
if c.ctx.Err() == nil {
|
||||
log.Error(c.ctx, "no builtin package", err)
|
||||
}
|
||||
break
|
||||
}
|
||||
decl, ok := astObj.Decl.(*ast.FuncDecl)
|
||||
|
Loading…
Reference in New Issue
Block a user