Commit ba2dfd9
snippets: add forrval snippet for single-variable range loops
Add a new snippet, forrval, that generates a for-range loop with a single variable, commonly used with channels and, in Go 1.23+, for value-only iteration over slices and maps.
The snippet expands to:
for v := range v {
}
Updates #4026
Change-Id: Id02283fb9ff6a77b4f76b279ae5196aac0bf0d8b
GitHub-Last-Rev: fa67748
GitHub-Pull-Request: #4027
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/770800
Auto-Submit: Madeline Kalil <mkalil@google.com>
Reviewed-by: Madeline Kalil <mkalil@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>1 parent b598774 commit ba2dfd9
1 file changed
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
83 | 88 | | |
84 | 89 | | |
85 | 90 | | |
| |||
0 commit comments