Skip to content

x/tools/gopls: feature request: support more postfix snippets for primitive type #73367

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

Open
xieyuschen opened this issue Apr 14, 2025 · 2 comments
Labels
FeatureRequest Issues asking for a new feature that does not need a proposal. 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

@xieyuschen
Copy link
Contributor

xieyuschen commented Apr 14, 2025

Feature I want

Gopls has provided some postfix snippet, for example:

Image

I believe we can add more useful postfix snippets:

  1. []byte!: help to convert a string to a slice of bytes.
  2. string!: help to convert a slices of bytes to a string.
  3. T!: help to convert a type from another, the postfix will generate |(variable) for users to input a type they want. | is the cursor position. Further more, we may provide some primitive type if the variable is a primitive(float, int, uint, etc...).
  4. itoa!: help to convert an int to string
  5. more cases...

Indeed we can provide a lot of helpful postfix snippets, not only the cases I mentioned above. Please kindly let me know your opinions about it. @adonovan @findleyr
I want to contribute these small features.

@xieyuschen xieyuschen added gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. labels Apr 14, 2025
@gopherbot gopherbot added this to the Unreleased milestone Apr 14, 2025
@gabyhelp gabyhelp added the FeatureRequest Issues asking for a new feature that does not need a proposal. label Apr 14, 2025
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/666195 mentions this issue: gopls/internal/golang/completion: tostring, tobytes postfix snippets

@findleyr
Copy link
Member

We should discuss this in our triage meeting today. The additions seem reasonable, but I want to avoid an combinatorial explosion of little helpers. I'm not sure we have a theory for what belongs as a snippet.

@ansaba ansaba modified the milestones: Unreleased, gopls/backlog Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest Issues asking for a new feature that does not need a proposal. 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

5 participants