golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.79k stars 728 forks source link

Support doc links for documentation previews as defined in https://go.dev/doc/comment #3230

Closed Splizard closed 4 months ago

Splizard commented 4 months ago

Go documentation comments recently added support for Doc Links, which refer to exported identifiers from either within the same package or an imported package.

When highlighting a Go identifier, these Doc Links should be displayed as clickable links that jump to the referenced identifier. They should also be highlightable within the comment themselves, so that the referenced identifier can be jumped to.

package main

type MyString string

// DoSomething prints "Hello World" as a [MyString]
//                                        ^ this should be highlightable
func DoSomething() {
    fmt.Println(MyString("Hello World"))
}
adonovan commented 4 months ago

We agree! This is essentially a duplicate of https://github.com/golang/go/issues/64648, of which the first part (semantic token support) was merged today, and the second part (hover and definition support) is currently in review.