Skip to content

Commit 8f66663

Browse files
authored
Add Go support to snippets (#1591)
This brings Go support to all appropriate built-in cursorless snippets. Go is tantalizingly close to typescript, but just different enough to need its own bodies. ## Checklist - [n/a] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [n/a] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [n/a] I have not broken the cheatsheet
1 parent 640abe9 commit 8f66663

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

cursorless-snippets/functionDeclaration.cursorless-snippets

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,23 @@
4747
}
4848
}
4949
},
50+
{
51+
"scope": {
52+
"langIds": [
53+
"go"
54+
]
55+
},
56+
"body": [
57+
"func $name($parameterList) {",
58+
"\t$body",
59+
"}"
60+
],
61+
"variables": {
62+
"name": {
63+
"formatter": "camelCase"
64+
}
65+
}
66+
},
5067
{
5168
"scope": {
5269
"langIds": [

cursorless-snippets/ifElseStatement.cursorless-snippets

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@
2323
"}"
2424
]
2525
},
26+
{
27+
"scope": {
28+
"langIds": [
29+
"go"
30+
]
31+
},
32+
"body": [
33+
"if $condition {",
34+
"\t$consequence",
35+
"} else {",
36+
"\t$alternative",
37+
"}"
38+
]
39+
},
2640
{
2741
"scope": {
2842
"langIds": [

cursorless-snippets/ifStatement.cursorless-snippets

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@
2121
"}"
2222
]
2323
},
24+
{
25+
"scope": {
26+
"langIds": [
27+
"go"
28+
]
29+
},
30+
"body": [
31+
"if $condition {",
32+
"\t$consequence",
33+
"}"
34+
]
35+
},
2436
{
2537
"scope": {
2638
"langIds": [

0 commit comments

Comments
 (0)