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

x/tools/gopls: add comma when completing the value of a key-value expression #46091

heschi opened this issue May 10, 2021 · 2 comments

Comments

@heschi
Copy link
Contributor

@heschi 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 label May 10, 2021
@heschi heschi added this to the gopls/unplanned milestone May 10, 2021
@danishprakash
Copy link

@danishprakash danishprakash commented May 31, 2021

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 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants