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

Package-level documentation not rendering on hover #3658

Open
GSmithApps opened this issue Jan 10, 2025 · 3 comments
Open

Package-level documentation not rendering on hover #3658

GSmithApps opened this issue Jan 10, 2025 · 3 comments
Labels
gopls gopls related issues
Milestone

Comments

@GSmithApps
Copy link

GSmithApps commented Jan 10, 2025

Is your feature request related to a problem? Please describe.
Package-level description isn't rendering

Describe the solution you'd like
I'd like the package-level description to render when hovering over an imported package, as shown in the screenshots below. ChatGPT suggests that if a package is spread across multiple files, Go uses first (alphabetically) nonempty comment, but I'm not totally sure. I don't know if VSCode is just getting confused.

Describe alternatives you've considered
One option is to ignore it. Another is to use GoLand. Another is to just always have the docs up

Additional context

GoLand

I know the docs are there. They're in doc.go, and they're rendering in Godoc, and they're showing in GoLand

https://pkg.go.dev/go.temporal.io/[email protected]/workflow#Go

Screenshot 2025-01-10 at 4 01 35 PM docs-are-in-doc-dot-go Using-GoLand

VSCode

Using-vscode
@gopherbot gopherbot added this to the Untriaged milestone Jan 10, 2025
@GSmithApps
Copy link
Author

GSmithApps commented Jan 10, 2025

I might be able to help out on this too

Here's the Godoc github. I figure their logic is in here somewhere. Maybe we could use that

@firelizzard18
Copy link
Contributor

@GSmithApps There's already logic in gopls for rendering package documentation. If you set "gopls": { "ui.documentation.hoverKind": "FullDocumentation" } and hover over the import URL it will render the full package documentation (the image below). The hover implementation is here. I'm not sure precisely what needs to be changed, but I believe it would only require a minor modification to hover.go. But this might not be something most users want to see. CC @findleyr

image

@firelizzard18 firelizzard18 added gopls gopls related issues and removed Documentation labels Jan 10, 2025
@GSmithApps
Copy link
Author

GSmithApps commented Jan 11, 2025

Hey @firelizzard18 thanks so much for looking at this! Yeah I'm having luck when I hover over the import statement, but not when I hover over the variable name that it imports to. In your example, it would be if you hover over testeval somewhere later in your code where you're using it. For my example, it's when I hover over the workflow variable later in my code.

And that includes if I add that note you posted to both my project and user-level settings.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls gopls related issues
Projects
None yet
Development

No branches or pull requests

3 participants