-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gopls/internal/golang: hover: show embedded fields
This change causes the hover information for a type to display the set of fields that are accessible due to promotion through one or more embedded fields. Change-Id: I7795daaeef6d5e910ae7917aa44d3012f4c016b7 Reviewed-on: https://go-review.googlesource.com/c/tools/+/559499 LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Alan Donovan <[email protected]> Reviewed-by: Robert Findley <[email protected]>
- Loading branch information
Showing
5 changed files
with
188 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
This test checks that hover reports accessible embedded fields | ||
(after the doc comment and before the accessible methods). | ||
|
||
-- go.mod -- | ||
module example.com | ||
|
||
go 1.18 | ||
|
||
-- q/q.go -- | ||
package q | ||
|
||
type Q struct { | ||
One int | ||
two string | ||
q2[chan int] | ||
} | ||
|
||
type q2[T any] struct { | ||
Three *T | ||
four string | ||
} | ||
|
||
-- p.go -- | ||
package p | ||
|
||
import "example.com/q" | ||
|
||
// doc | ||
type P struct { | ||
q.Q | ||
} | ||
|
||
func (P) m() {} | ||
|
||
var p P //@hover("P", "P", P) | ||
|
||
-- @P -- | ||
```go | ||
type P struct { | ||
q.Q | ||
} | ||
``` | ||
|
||
doc | ||
|
||
|
||
```go | ||
// Embedded fields: | ||
One int // through Q | ||
Three *chan int // through Q.q2 | ||
``` | ||
|
||
```go | ||
func (P) m() | ||
``` | ||
|
||
[`p.P` on pkg.go.dev](https://pkg.go.dev/example.com#P) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters