Skip to content

x/tools/gopls: show hex/binary literal with which a const was declared on mouse over #47453

@soypat

Description

@soypat

What did you do?

Mouse over a hex/binary notation integer

const hex, bin, oct = 0xe34e, 0b10101, 071

// Mouse over variable name `hex` or `bin` shows decimal representation
c := hex * bin

What did you expect to see?

The literal used to declare the const. Usually when one declares a const in hex, binary or octal representation it carries with it a significance, to aid the reader of the code. If we wrote programs for machines gofmt would convert these literals to decimals or whatever the computer like.

With the philosophy out of the way, I expected to see:

  • const hex untyped int = 0xe34e (58190)
  • const bin untyped int = 0b10101 (21).

What did you see instead?

The usual gopls help string of

  • const hex untyped int = 58190
  • const bin untyped int = 21.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions