mirror of https://github.com/golang/go.git
internal/lsp: fix panic in builtin completions
Fixes golang/go#38091 Change-Id: I88ac6d3413de3dd9d235e2f2fca9b4a3f7127e0a Reviewed-on: https://go-review.googlesource.com/c/tools/+/227026 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Rohan Challa <rohan@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
0a46fa39b0
commit
9fc00b0a7f
|
|
@ -59,6 +59,9 @@ func (c *completer) builtinArgType(obj types.Object, call *ast.CallExpr, parentI
|
|||
|
||||
switch obj.Name() {
|
||||
case "append":
|
||||
if parentInf.objType == nil {
|
||||
break
|
||||
}
|
||||
inf.objType = parentInf.objType
|
||||
|
||||
// Check if we are completing the variadic append() param.
|
||||
|
|
|
|||
|
|
@ -17,3 +17,4 @@ func _() {
|
|||
// Don't add "..." to append() argument.
|
||||
bar(append()) //@snippet("))", appendStrings, "aStrings", "aStrings")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
package append
|
||||
|
||||
func _() {
|
||||
_ = append(a, struct) //@complete(")")
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
-- summary --
|
||||
CodeLensCount = 2
|
||||
CompletionsCount = 237
|
||||
CompletionsCount = 238
|
||||
CompletionSnippetCount = 75
|
||||
UnimportedCompletionsCount = 11
|
||||
DeepCompletionsCount = 5
|
||||
|
|
|
|||
Loading…
Reference in New Issue