Skip to content

Commit ec308c7

Browse files
tronikelislewis6991
authored andcommitted
feat(go): added variable initialization context
1 parent 41847d3 commit ec308c7

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

queries/go/context.scm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@
3333
communication: (_)
3434
(_) @context.end
3535
) @context
36+
37+
(composite_literal
38+
body: (literal_value (_) @context.end)
39+
) @context

test/lang/test.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,47 @@ b int) int { // {{CONTEXT}}
2020
// {{CURSOR}}
2121
}
2222

23+
// {{TEST}}
24+
var bigstruct = struct{ // {{CONTEXT}}
25+
a, b, c, d, e, f, g, h, i, j, k, l, m, n int // {{CONTEXT}}
26+
}{ // {{CONTEXT}}
27+
a: 0,
28+
b: 0,
29+
c: 0,
30+
d: 0,
31+
e: 0,
32+
f: 0,
33+
g: 0,
34+
h: 0,
35+
i: 0,
36+
j: 0,
37+
k: 0,
38+
l: 0,
39+
m: 0,
40+
// {{CURSOR}}
41+
n: 0,
42+
}
43+
44+
// {{TEST}}
45+
var bigslice = []int{ // {{CONTEXT}}
46+
1,
47+
2,
48+
3,
49+
4,
50+
5,
51+
6,
52+
7,
53+
8,
54+
9,
55+
10,
56+
11,
57+
12,
58+
13,
59+
14,
60+
// {{CURSOR}}
61+
15,
62+
}
63+
2364
var b
2465
,c
2566
,d int = 1, 2

0 commit comments

Comments
 (0)