Skip to content

x/tools/gopls: prefix SignatureHelp label with "func" #74917

@skewb1k

Description

@skewb1k

Not an issue, but feature request.
Currently, SignatureHelp returns a label that is not valid Go code, which makes it difficult to parse and highlight it for clients. Many language servers work-around this by prefixing output with function declaration keyword, even though it might be redundant in the context of SignatureHelp. Unfortunately, this seems to be the only way to give the client enough context to parse the signature correctly. So there's a tradeoff here.

I've tried this and here’s a screenshots of Neovim:
Image

Image

Interestingly, this already happens naturally for anonymous functions, since we use "func" as their name. So the change wouldn't affect those:
Image

One more, perhaps not very important, point is that it makes SignatureHelp match Hover look, which makes it easier to align with expectations for how function information is displayed.

I'm asking for feedback on the proposal and would be happy to submit the change - I already have a POC version ready.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.ToolProposalIssues describing a requested change to a Go tool or command-line program.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions