Skip to content

Commit 23b46c9

Browse files
snippets: add forrch snippet for single-variable range loops
Add a new snippet 'forrch' that generates a for-range loop with a single variable, commonly used with channels
1 parent a8fb60c commit 23b46c9

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

extension/snippets/go.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@
8080
"body": "for ${1:_}, ${2:v} := range ${3:v} {\n\t$0\n}",
8181
"description": "Snippet for a for range loop"
8282
},
83+
"for range channel statement": {
84+
"prefix": "forrch",
85+
"body": "for ${1:v} := range ${2:v} {\n\t$0\n}",
86+
"description": "Snippet for a for range loop with single variable (channel)"
87+
},
8388
"channel declaration": {
8489
"prefix": "ch",
8590
"body": "chan ${1:type}",

0 commit comments

Comments
 (0)