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: add comma when completing the value of a key-value expression #46091

Open
heschi opened this issue May 10, 2021 · 2 comments
Open
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.

Comments

@heschi
Copy link
Contributor

heschi commented May 10, 2021

If I complete an entire KV, I get the colon and comma:

_ = foo {
 <>
}

becomes

_ = foo {
  key: [value placeholder],
}

On the other hand, if I complete just the value, I have to go to the work of pressing the comma key myself:

_ = foo {
  key: <>
}

becomes

_ = foo {
  key: [value]
}

This could probably save me multiple keypresses per week.

@muirdm

@heschi heschi added the gopls Issues related to the Go language server, gopls. label May 10, 2021
@heschi heschi added this to the gopls/unplanned milestone May 10, 2021
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label May 10, 2021
@danishprakash
Copy link

While I agree with what you've described, could you point out which editor you use? I know about vim's line completion but I want to understand how you're able to complete an entire KV.

@muirdm
Copy link

muirdm commented May 31, 2021

how you're able to complete an entire KV

It is a gopls snippet when completing struct literal field names. You get the comma if the field name is on a different line than the open curly.

This could probably save me multiple keypresses per week.

Granted, but we need to weigh that against how many keystrokes it takes to implement the feature.

Jokes aside, I think this could work, but gopls would have to leave the cursor before the comma. If the user intends to add more to the expression it would be annoying for the cursor to jump to the far side of the comma after accepting the first completion.

@stamblerre stamblerre added the FeatureRequest Issues asking for a new feature that does not need a proposal. label Jun 1, 2021
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