Skip to content

Commit

Permalink
test/gopls: fix completion middleware test
Browse files Browse the repository at this point in the history
gopls v0.5.0 seems to change the completion result ranking, so
the test that checked a specific entry for the most plausible
result is broken.  This CL made the test use a more specific
query (fmt.P<> instead of fmt.<>) so the test can pass with
gopls 0.4.x and 0.5.0.

Probably, it's better to just check whether the desirable entry
is in one of the top k results where k is a reasonablly small
but larger than 1. I don't know what's a good number yet.

Fixes #649

Change-Id: I805b2f1b2c4ae6dde19f6a931434b46fb0954510
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/255119
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
  • Loading branch information
hyangah committed Sep 16, 2020
1 parent 59858d7 commit 5879a3e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/gopls/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ suite('Go Extension Tests With Gopls', function () {
await env.reset('gogetdocTestData');
const { uri } = await env.openDoc('test.go');
const testCases: [string, vscode.Position, string][] = [
['fmt.<>', new vscode.Position(19, 5), 'Formatter'],
['fmt.P<>', new vscode.Position(19, 6), 'Print'],
];
for (const [name, position, wantFilterText] of testCases) {
let list: vscode.CompletionList<vscode.CompletionItem>;
Expand Down

0 comments on commit 5879a3e

Please sign in to comment.