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: format constant time.Duration in hover tooltip #44667
Comments
Thanks for the feature request, @ShoshinNikita |
The current hover information for constant time.Duration is not very useful because it displays nanoseconds. So, show formatted duration as an inline comment. Fixes golang/go#44667
Change https://golang.org/cl/297310 mentions this issue: |
It should be possible to do that. I wonder if that might be the most useful thing in general: const flagA = 1
const flagB = 2
// Showing "3" isn't very useful. Showing "flagA | flagB" might be useful.
const someMask = flagA | flagB
const durA = 1*time.Minute
const durB = 1*time.Second
// Showing nanoseconds is not helpful. Showing "59s" might be helpful, but showing "durA - durB" might have the most meaning.
const timeout = durA - durB |
I agree |
The current hover tooltip for
const X time.Duration
is not very useful because it displays nanoseconds:I guess it's not possible to display an actual declaration (
20 * time.Second
in this example). But I think it would be a good solution to display formatted duration as a comment. Something like this:The text was updated successfully, but these errors were encountered: