mirror of
https://github.com/golang/go
synced 2024-11-18 08:54:45 -07:00
internal/lsp/source: handle nil pointer in package name hover
Updates golang/go#38977. Change-Id: I8cbf0b058d77e749285cfe41b4b49de3764be861 Reviewed-on: https://go-review.googlesource.com/c/tools/+/233177 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
e48fac377d
commit
8b0f8a7919
@ -103,6 +103,10 @@ func findIdentifier(ctx context.Context, s Snapshot, pkg Package, file *ast.File
|
||||
declAST = f
|
||||
}
|
||||
}
|
||||
// If there's no package documentation, just use current file.
|
||||
if declAST == nil {
|
||||
declAST = file
|
||||
}
|
||||
declRng, err := posToMappedRange(view, pkg, declAST.Name.Pos(), declAST.Name.End())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user