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
Labels
gopls Issues related to the Go language server, gopls. help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@muirdm
Copy link

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 Issues related to the Go language server, 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
@stamblerre stamblerre added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 2, 2019
@stamblerre stamblerre added the Suggested Issues that may be good for new contributors looking for work to do. label Jul 10, 2019
@stamblerre stamblerre added help wanted and removed Suggested Issues that may be good for new contributors looking for work to do. labels Aug 8, 2019
@gopherbot
Copy link

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

@stamblerre stamblerre reopened this Dec 4, 2019
@stamblerre stamblerre modified the milestones: Unreleased, gopls unplanned Dec 4, 2019
@stamblerre stamblerre modified the milestones: gopls unplanned, gopls completion Jan 29, 2020
@stamblerre stamblerre removed this from the gopls/v0.5.0 milestone Jun 24, 2020
@seh
Copy link
Contributor

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
Labels
gopls Issues related to the Go language server, gopls. help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants