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: evaluate hex/binary integer literals when mousing over #45802

Closed
soypat opened this issue Apr 27, 2021 · 6 comments
Closed

x/tools/gopls: evaluate hex/binary integer literals when mousing over #45802

soypat opened this issue Apr 27, 2021 · 6 comments
Labels
FeatureRequest FrozenDueToAge 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

@soypat
Copy link

soypat commented Apr 27, 2021

What version of Go are you using (go version)?

$ gopls version
golang.org/x/tools/gopls v0.6.10
    golang.org/x/tools/gopls@v0.6.10 h1:8Ebz8PymS2umcuCFhoz67unyJfWsipjTIrkBUF9kypg=

$ VsCode settings:
 "gopls": {	
        "ui.semanticTokens": true,
	},
    "editor.semanticHighlighting.enabled": true,

What did you do?

Mouse over a hex/binary notation integer

var (

    hex = 0xe34e
    bigBin = 0b1001001
    x = hex*0b1101
)

What did you expect to see?

Gopls evaluate the number in decimal form and show me the result (I'm in VSCode). Gopls does this for const identifiers and it is super helpful!

What did you see instead?

Nothing

@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 Apr 27, 2021
@gopherbot gopherbot added this to the Unreleased milestone Apr 27, 2021
@soypat soypat changed the title x/tools/gopls x/tools/gopls Evaluate hex/binary integer literals when mousing over Apr 27, 2021
@soypat soypat changed the title x/tools/gopls Evaluate hex/binary integer literals when mousing over x/tools/gopls: Evaluate hex/binary integer literals when mousing over Apr 27, 2021
@stamblerre stamblerre changed the title x/tools/gopls: Evaluate hex/binary integer literals when mousing over x/tools/gopls: evaluate hex/binary integer literals when mousing over Apr 27, 2021
@suzmue suzmue modified the milestones: Unreleased, gopls/unplanned Apr 27, 2021
@danishprakash
Copy link

I'd like to work on this cc: @stamblerre

@stamblerre
Copy link
Contributor

@danishprakash: Sounds good! Let me know if you need any guidance.

@danishprakash
Copy link

@stamblerre I tried dabbling with this and have pushed my changes here https://github.com/golang/tools/compare/master...danishprakash:hover-evaluate-hex?expand=1. Let me know if that approach sounds good, I'll raise a pull request.

@stamblerre
Copy link
Contributor

Thanks for working on that @danishprakash! It does look like the right approach so feel free to send a PR.

@danishprakash
Copy link

Posting the PR link here https://go-review.googlesource.com/c/tools/+/330309, not sure if the bot would backlink this. (ideally we should)

@gopherbot
Copy link

Change https://golang.org/cl/330309 mentions this issue: internal/lsp/source: evaluate bin/hex literal on hover

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FeatureRequest FrozenDueToAge 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

5 participants