forked from golang/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/lsp/source: respond with the underlying type to Type Definit…
…ion requests for composite types Go to Type Definition works for all composite types except maps because it is not clear which type to return if both key and value are named types. Fixes golang/go#45029 Change-Id: Ie14f333c51af11033e2494aaaac367d35e7dc87b GitHub-Last-Rev: 94a0481 GitHub-Pull-Request: golang#292 Reviewed-on: https://go-review.googlesource.com/c/tools/+/304789 Reviewed-by: Rebecca Stambler <rstambler@golang.org> Trust: Rebecca Stambler <rstambler@golang.org> Trust: Heschi Kreinick <heschi@google.com> Run-TryBot: Rebecca Stambler <rstambler@golang.org> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org>
- Loading branch information
1 parent
682c7e6
commit af36406
Showing
3 changed files
with
45 additions
and
1 deletion.
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,38 @@ | ||
package typdef | ||
|
||
type Struct struct { //@item(Struct, "Struct", "struct{...}", "struct") | ||
Field string | ||
} | ||
|
||
type Int int //@item(Int, "Int", "int", "type") | ||
|
||
func _() { | ||
var ( | ||
value Struct | ||
point *Struct | ||
) | ||
_ = value //@typdef("value", Struct) | ||
_ = point //@typdef("point", Struct) | ||
|
||
var ( | ||
array [3]Struct | ||
slice []Struct | ||
ch chan Struct | ||
complex [3]chan *[5][]Int | ||
) | ||
_ = array //@typdef("array", Struct) | ||
_ = slice //@typdef("slice", Struct) | ||
_ = ch //@typdef("ch", Struct) | ||
_ = complex //@typdef("complex", Int) | ||
|
||
var s struct { | ||
x struct { | ||
xx struct { | ||
field1 []Struct | ||
field2 []Int | ||
} | ||
} | ||
} | ||
s.x.xx.field1 //@typdef("field1", Struct) | ||
s.x.xx.field2 //@typdef("field2", Int) | ||
} |