Description
Is your feature request related to a problem? Please describe.
I want the inline type hints to link to the declaration of the type they're hinting.
Describe the solution you'd like
When you (on Windows) alt-click on the identifiers on a type hint, VS Code should make a new tab/navigate to the definition/declaration of that type.
Describe alternatives you've considered
You can already do this "alt-click to go to declaration" feature with variable names, function names, method names, and explicit type names.
Go allows :=
to declare a variable and infer the type; this is a common pattern and idiomatic Go. However, without type hints, it can be difficult to determine what type something is:
foo := someFunction() // what type is `foo` on first glance?
var bar SomeType = someFunction() // it's clear that `bar` is a SomeType
If type hints were enabled, it would look like this (where `name`
is the type hint):
foo `SomeType` := someFunction() // much more clear that foo is SomeType
var bar SomeType = someFunction()
Then you can alt-click the type hint to jump to the definition of SomeType
, like with the explicit type on bar
.
Additional context
The rust-analyzer
VS Code plugin does this, and it's massively helpful when quickly searching through code that doesn't have many explicit types.
The Go extension's type hints:
rust-analyzer's type hints, with a link to the type declaration: