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: bad completion insertion after syntax error #32510

Open
muirdm opened this issue Jun 9, 2019 · 2 comments
Open

x/tools/gopls: bad completion insertion after syntax error #32510

muirdm opened this issue Jun 9, 2019 · 2 comments

Comments

@muirdm
Copy link

@muirdm muirdm commented Jun 9, 2019

In this code

package foo

func foo() {
	foo(a ...interface{})
	f<>
}

Completing "f" to "foo" ends up inserting "ffoo" instead of "foo". This is because the syntax error on the previous line completely obscures the "f" *ast.Ident, so we don't detect it properly as the prefix. Perhaps if we are in a BadExpr we could "manually" detect the surrounding identifier so completion still works to some degree?

/cc @stamblerre

@gopherbot gopherbot added this to the Unreleased milestone Jun 9, 2019
@gopherbot gopherbot added the gopls label Jun 9, 2019
@stamblerre stamblerre changed the title x/tools/cmd/gopls: bad completion insertion after syntax error x/tools/gopls: bad completion insertion after syntax error Jul 2, 2019
@gopherbot
Copy link

@gopherbot gopherbot commented Sep 12, 2019

Change https://golang.org/cl/195039 mentions this issue: internal/lsp: fix completion prefix detection with syntax errors

@stamblerre stamblerre closed this Dec 4, 2019
@stamblerre stamblerre reopened this Dec 4, 2019
@stamblerre stamblerre removed this from the Unreleased milestone Dec 4, 2019
@stamblerre stamblerre added this to the gopls unplanned milestone Dec 4, 2019
@stamblerre stamblerre removed this from the gopls unplanned milestone Jan 29, 2020
@stamblerre stamblerre added this to the gopls completion milestone Jan 29, 2020
@stamblerre stamblerre removed this from the gopls completion milestone May 21, 2020
@stamblerre stamblerre added this to the gopls/v0.5.0 milestone May 21, 2020
@stamblerre stamblerre removed this from the gopls/v0.5.0 milestone Jun 24, 2020
@seh
Copy link
Contributor

@seh seh commented Oct 4, 2020

What's weird is that it seems that this problem only arises the first time selecting a given completion. If I delete some text, then type enough again to summon the same completion, if I select one I've selected before, I don't get the extra text inserted.

I described this problem in the "emacs" channel in the "Gophers" Slack workspace.

@stamblerre stamblerre added this to the gopls/unplanned milestone Oct 21, 2020
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
4 participants