Skip to content

Gopls test autocompletion issue #3699

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

Closed
2 of 3 tasks
vadimi opened this issue Aug 28, 2022 · 2 comments
Closed
2 of 3 tasks

Gopls test autocompletion issue #3699

vadimi opened this issue Aug 28, 2022 · 2 comments
Labels

Comments

@vadimi
Copy link

vadimi commented Aug 28, 2022

Thank you for the bug report

  • I am using the latest version of lsp-mode related packages.
  • I checked FAQ and Troubleshooting sections
  • You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain

Bug description

gopls offers test method generation autocompletion by typing in func Tes. But for some reason after test method is generated the text used for method generation gets copied outside of the method declation, please see this video:

go_autocomplete.mov

Steps to reproduce

  1. open any go test file (xxx_test.go)
  2. type in func Tes to see the autocompletion popup
  3. press Enter

Expected behavior

test method should get generated without copying text to the end of the method declaration

Which Language Server did you use?

lsp-go with gopls

OS

MacOS

Error callstack

No response

Anything else?

No response

@vadimi vadimi added the bug label Aug 28, 2022
@vikblom
Copy link

vikblom commented Nov 19, 2022

Hi, I have the same issue.

I restarted gopls with the -rpc.trace argument and can see the completion going to the server.

Request:

[Trace - 16:49:00.821 PM] Sending request 'textDocument/completion - (3947)'.
Params: {"textDocument":{"uri":"file:///home/viktor/tmp/complete/complete_test.go"},"position":{"line":2,"character":13},"context":{"triggerKind":1}}

Response:

[Trace - 16:49:00.821 PM] Received response 'textDocument/completion - (3947)' in 0ms.
Result: {"isIncomplete":true,"itemDefaults":{"editRange":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}}},"items":[{"label":"TestSome(t *testing.T)","labelDetails":{},"kind":3,"documentation":"complete the parameter","preselect":true,"sortText":"00000","filterText":"TestSome(t *testing.T)","insertTextFormat":2,"textEdit":{"range":{"start":{"line":2,"character":5},"end":{"line":2,"character":5}},"newText":"TestSome(t *testing.T)"}}]}

If I understand LSP correctly then having start == end like in "textEdit":{"range":{"start":{"line":2,"character":5},"end":{"line":2,"character":5}} means the completion will just insert text.

So could this be a problem in gopls?

@vadimi
Copy link
Author

vadimi commented Apr 25, 2023

@vikblom I just installed the newly released [email protected] and the issue if fixed for me! Thanks a lot for taking care of it!

@vadimi vadimi closed this as completed Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants