-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gopls/internal/regtest/marker: port the selectionrange markers
For golang/go#54845 Change-Id: I289688a677fa6497035912eb2330bb3f0e963392 Reviewed-on: https://go-review.googlesource.com/c/tools/+/541129 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Robert Findley <rfindley@google.com>
- Loading branch information
Showing
7 changed files
with
89 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
-- summary -- | ||
CallHierarchyCount = 2 | ||
SelectionRangesCount = 3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
gopls/internal/regtest/marker/testdata/selectionrange/selectionrange.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
This test checks selection range functionality. | ||
|
||
-- foo.go -- | ||
package foo | ||
|
||
import "time" | ||
|
||
func Bar(x, y int, t time.Time) int { | ||
zs := []int{1, 2, 3} //@selectionrange("1", a) | ||
|
||
for _, z := range zs { | ||
x = x + z + y + zs[1] //@selectionrange("1", b) | ||
} | ||
|
||
return x + y //@selectionrange("+", c) | ||
} | ||
-- @a -- | ||
Ranges 0: | ||
5:13-5:14 "1" | ||
5:7-5:21 "[]int{1, 2, 3}" | ||
5:1-5:21 "zs := []int{1, 2, 3}" | ||
4:36-12:1 "{\\n\tzs := []int{...range(\"+\", c)\\n}" | ||
4:0-12:1 "func Bar(x, y i...range(\"+\", c)\\n}" | ||
0:0-12:1 "package foo\\n\\nim...range(\"+\", c)\\n}" | ||
-- @b -- | ||
Ranges 0: | ||
8:21-8:22 "1" | ||
8:18-8:23 "zs[1]" | ||
8:6-8:23 "x + z + y + zs[1]" | ||
8:2-8:23 "x = x + z + y + zs[1]" | ||
7:22-9:2 "{\\n\t\tx = x + z +...ange(\"1\", b)\\n\t}" | ||
7:1-9:2 "for _, z := ran...ange(\"1\", b)\\n\t}" | ||
4:36-12:1 "{\\n\tzs := []int{...range(\"+\", c)\\n}" | ||
4:0-12:1 "func Bar(x, y i...range(\"+\", c)\\n}" | ||
0:0-12:1 "package foo\\n\\nim...range(\"+\", c)\\n}" | ||
-- @c -- | ||
Ranges 0: | ||
11:8-11:13 "x + y" | ||
11:1-11:13 "return x + y" | ||
4:36-12:1 "{\\n\tzs := []int{...range(\"+\", c)\\n}" | ||
4:0-12:1 "func Bar(x, y i...range(\"+\", c)\\n}" | ||
0:0-12:1 "package foo\\n\\nim...range(\"+\", c)\\n}" |