mirror of
https://github.com/golang/go
synced 2024-11-18 07:54:55 -07:00
internal/lsp/source: handle nil pointer in comment completions
c.pkg.GetTypeInfo().ObjectOf(node.Name) will sometimes return nil. Check for that and a few other things that c.found also checks for. Fixes golang/go#40043 Change-Id: I4a2b40adbbd740323e10b3460f025b29cff74130 Reviewed-on: https://go-review.googlesource.com/c/tools/+/241019 Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
0cc1aa72b3
commit
95bc2bdf7e
@ -755,6 +755,9 @@ func (c *completer) populateCommentCompletions(ctx context.Context, comment *ast
|
||||
}
|
||||
|
||||
obj := c.pkg.GetTypesInfo().ObjectOf(node.Name)
|
||||
if obj == nil || obj.Pkg() != nil && obj.Pkg() != c.pkg.GetTypes() {
|
||||
continue
|
||||
}
|
||||
|
||||
// We don't want expandFuncCall inside comments. We add this directly to the
|
||||
// completions list because using c.found sets expandFuncCall to true by default
|
||||
|
Loading…
Reference in New Issue
Block a user