Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: show underlying type on hover over alias #71286

Open
jacobzim-stl opened this issue Jan 15, 2025 · 1 comment
Open

x/tools/gopls: show underlying type on hover over alias #71286

jacobzim-stl opened this issue Jan 15, 2025 · 1 comment
Assignees
Labels
FeatureRequest Issues asking for a new feature that does not need a proposal. gopls Issues related to the Go language server, gopls. help wanted Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@jacobzim-stl
Copy link

jacobzim-stl commented Jan 15, 2025

gopls version

golang.org/x/tools/gopls v0.17.1

go env

n/a

What did you do?

Note: this is a feature request

Given

// This is a dog.
type Dog struct {
    Name string `json:"name"`
    Age int `json:"age"`
}

type Hound = Dog

// A Puppy is a Dog with an age less than 2.
type Puppy = Dog

I hovered over Hound and Puppy

What did you see happen?

The hover message reads

type Hound = Dog

and respectively

type Puppy = Dog

A puppy is a dog with an age less than 2.

What did you expect to see?

type Hound = Dog

This is a dog.

type Dog struct {
    Name string `json:"name"`
    Age int `json:"age"`
}

and respectively

type Puppy = Dog

A puppy is a dog with an age less than 2.

type Dog struct {
    Name string `json:"name"`
    Age int `json:"age"`
}

I like the semantic that docstrings are inherited if, and only if, the alias provides no docstring of its own.

Editor and settings

n/a

Logs

n/a

@jacobzim-stl jacobzim-stl added gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. labels Jan 15, 2025
@gopherbot gopherbot added this to the Unreleased milestone Jan 15, 2025
@findleyr findleyr added the FeatureRequest Issues asking for a new feature that does not need a proposal. label Jan 15, 2025
@findleyr
Copy link
Member

This sounds like a nice improvement. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest Issues asking for a new feature that does not need a proposal. gopls Issues related to the Go language server, gopls. help wanted Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants