Skip to content

how to add a second result type in Go? #1788

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
josharian opened this issue Aug 15, 2023 · 2 comments
Open

how to add a second result type in Go? #1788

josharian opened this issue Aug 15, 2023 · 2 comments
Labels
lang-go Issues related to Go programming language support

Comments

@josharian
Copy link
Collaborator

josharian commented Aug 15, 2023

Single result:

func f() error {

Multiple:

func f() ([]byte, error) {

This is a very common transformation during refactoring.

Two questions:

  • How do you refer to error? (Just need pick the right scope name.)
  • Does Cursorless have the infrastructure to add the round wrap after a (say) "drink value/arg/type each"? May interact with Support destination pseudo-scopes #1631 in that prefix/postfix might be relevant when going from 1 to many, not just 0 to 1.
@josharian josharian added the lang-go Issues related to Go programming language support label Aug 15, 2023
@josharian josharian changed the title how to add a second return type in Go? how to add a second result type in Go? Aug 15, 2023
@josharian
Copy link
Collaborator Author

Maybe different, but related problem: going from anonymous result to named result:

func f() error {
func f() (err error) {

@josharian josharian added the to discuss Plan to discuss at meet-up label Aug 15, 2023
@pokey
Copy link
Member

pokey commented Aug 15, 2023

I'd probably use a wrapper snippet combined with the "type" scope. So eg "tuple wrap type". And you could have a different spoken form for wrapping into the second slot rather than first

Without snippets, prob would be "round wrap type drink item source" (or pour)

The anonymous to named could also be a snippet, or "round wrap type drink token source"

@pokey pokey removed the to discuss Plan to discuss at meet-up label Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang-go Issues related to Go programming language support
Projects
None yet
Development

No branches or pull requests

2 participants