Skip to content

Commit

Permalink
gopls/internal/regtest/marker: port rank and func_rank tests
Browse files Browse the repository at this point in the history
Port a couple tests related to ranking. In both cases, some minor
modifications to the test data were required:
- In rank.txt, a couple literal completions had to be added, because the
  new marker tests don't disable literal completions (there is no
  setting to do so; the old marker tests reach into the internals).
- In rank.txt a couple ranking assertions that require deep completion
  are disabled, because other @complete markers break if deep completion
  is enabled. An artifact of static options.
- In func_rank.txt, an additional item is added where fuzzy matching
  found more results (old markers use the non-default caseinsensitive
  matching).

As described in CL 538797, porting completion tests is a blocker for
zero config gopls.

For golang/go#57979
For golang/go#54845

Change-Id: I78f9a2b3b07db570b7c86b45d61c01941b9896ac
Reviewed-on: https://go-review.googlesource.com/c/tools/+/538799
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Alan Donovan <[email protected]>
  • Loading branch information
findleyr committed Nov 2, 2023
1 parent 970eac5 commit 5e2efda
Show file tree
Hide file tree
Showing 11 changed files with 229 additions and 178 deletions.
19 changes: 0 additions & 19 deletions gopls/internal/lsp/testdata/rank/assign_rank.go.in

This file was deleted.

8 changes: 0 additions & 8 deletions gopls/internal/lsp/testdata/rank/binexpr_rank.go.in

This file was deleted.

11 changes: 0 additions & 11 deletions gopls/internal/lsp/testdata/rank/boolexpr_rank.go

This file was deleted.

57 changes: 0 additions & 57 deletions gopls/internal/lsp/testdata/rank/convert_rank.go.in

This file was deleted.

11 changes: 0 additions & 11 deletions gopls/internal/lsp/testdata/rank/struct/struct_rank.go

This file was deleted.

29 changes: 0 additions & 29 deletions gopls/internal/lsp/testdata/rank/switch_rank.go.in

This file was deleted.

8 changes: 0 additions & 8 deletions gopls/internal/lsp/testdata/rank/type_assert_rank.go.in

This file was deleted.

31 changes: 0 additions & 31 deletions gopls/internal/lsp/testdata/rank/type_switch_rank.go.in

This file was deleted.

6 changes: 3 additions & 3 deletions gopls/internal/lsp/testdata/summary.txt.golden
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
-- summary --
CallHierarchyCount = 2
CompletionsCount = 96
CompletionSnippetCount = 21
RankedCompletionsCount = 78
CompletionsCount = 72
CompletionSnippetCount = 18
RankedCompletionsCount = 56
SemanticTokenCount = 3
SuggestedFixCount = 80
MethodExtractionCount = 8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
This test checks various ranking of completion results within function call
context.

-- flags --
-ignore_extra_diags

-- settings.json --
{
"completeUnimported": false,
"deepCompletion": false
}

-- func_rank.go --
package func_rank

import "net/http"
Expand Down Expand Up @@ -38,7 +51,7 @@ func _() {

var aaPtr *string //@item(rankAAPtr, "aaPtr", "*string", "var")
var abPtr *int //@item(rankABPtr, "abPtr", "*int", "var")
fnInt(*a) //@complete(")", rankABPtr, rankAAPtr)
fnInt(*a) //@complete(")", rankABPtr, rankAAPtr, stringAVar)

_ = func() string {
return s.A //@complete(" //", rankAB, rankAA, rankAC)
Expand Down
Loading

0 comments on commit 5e2efda

Please sign in to comment.