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: Hover on 'package' declaration should reveal per-file language version #68900

Closed
adonovan opened this issue Aug 15, 2024 · 1 comment
Assignees
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@adonovan
Copy link
Member

adonovan commented Aug 15, 2024

The algorithm for deducing which version of the Go spec applies to a given Go source file, and which GODEBUG and GOEXPERIMENT flags are in force, is unfortunately rather complicated. Gopls could help by adding to the Hover result for the package declaration an explanation of which Go version is in force and why, and the values of any non-default GODEBUG and/or GOEXPERIMENT settings. (Other UI approaches are possible.)

@adonovan adonovan added this to the gopls/v0.17.0 milestone Aug 15, 2024
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Aug 15, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/626276 mentions this issue: gopls/internal/golang: show package attributes on hover

dennypenta pushed a commit to dennypenta/tools that referenced this issue Dec 3, 2024
When hovering over a package name in a package declaration, show
language version and GODEBUG values that differ from the toolchain
default. Also, for consistency with other hover content, show the
package declaration as the 'signature' of both a package name and an
import.

Finally, to help differentiate this information, introduce hlines in
the hover output between logical sections. This is similar to what is
done by other LSP servers such as tsserver.

Fixes golang/go#68900

Change-Id: I5013bb9fb4086c71cc3565fd67993764cad69237
Reviewed-on: https://go-review.googlesource.com/c/tools/+/626276
Reviewed-by: Alan Donovan <[email protected]>
Auto-Submit: Robert Findley <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. 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