Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GSmithApps committed Feb 4, 2025
1 parent 0e0bba1 commit c1d90f1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions gopls/internal/golang/hover.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ func hover(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle, pp pro
// The general case: compute hover information for the object referenced by
// the identifier at pos.
ident, obj, selectedType := referencedObject(pkg, pgf, pos)
if obj == nil || ident == nil {
return protocol.Range{}, nil, nil // no object to hover
}

if pkgName, ok := obj.(*types.PkgName); ok {
rng, hoverRes, err := hoverPackageIdent(ctx, snapshot, pkg, pgf, ident, pkgName.Imported().Path())
Expand All @@ -270,10 +273,6 @@ func hover(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle, pp pro
return *hoverRange, hoverRes, nil // (hoverRes may be nil)
}

if obj == nil || ident == nil {
return protocol.Range{}, nil, nil // no object to hover
}

// Unless otherwise specified, rng covers the ident being hovered.
if hoverRange == nil {
rng, err := pgf.NodeRange(ident)
Expand Down

0 comments on commit c1d90f1

Please sign in to comment.