golang/go

x/tools/gopls: suggested completions include many irrelevant, non-deterministic entries

オープン

#43,374 opened on 2020/12/25

 (5 件のコメント) (1 件のリアクション) (0 人の担当者)Go (19,008 件のフォーク)batch import
Toolsgoplsgopls/completionhelp wanted

Repository metrics

Stars
 (133,883 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

What version of Go are you using (go version)?

Does this issue reproduce with the latest release?

Yes, and with the current tip of gopls as well.

What operating system and processor architecture are you using (go env)?

linux/amd64

What did you do?

I can reproduce this with basically any code.

But concretely, I used this single-file package:

package main

func f(int) {}

func x() {
	n := 3
	m := 4
	f(|)
}

The | is where my cursor is when I invoked autocompletion.

What did you expect to see?

I expected to see completions that make sense given the types involved. Whatever the completions I saw, I expected that if I invoked autocompletion a second time without making any change whatsoever, I should see the same list of suggestions again.

What did you see instead?

I saw a long list with many irrelevant suggestions. Additionally, every time I invoked autocompletion, the list was different.

I noticed this in my usual environment (vim + govim) but I can reproduce with vscode as well. Here are some screenshots (I pressed ctrl-space three times in a row and got these three results):

screen_20201224235014

screen_20201224235025

screen_20201224235033

コントリビューターガイド