Skip to content

Commit bcd5d31

Browse files
committed
add branch support to Go
1 parent c5ef8fc commit bcd5d31

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

queries/go.scm

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,32 @@
222222
.
223223
)
224224
) @anonymousFunction @namedFunction
225+
226+
(
227+
[
228+
(default_case)
229+
(expression_case)
230+
(type_case)
231+
] @branch
232+
233+
;; TODO: insertion delimiters snafu
234+
235+
;; The following is almost right, for drink and pour,
236+
;; although it would be best if the cursor was just before the colon.
237+
;; It also has some leading whitespace problems.
238+
;;
239+
(#insertion-delimiter! @branch "case :\n\n")
240+
241+
;; This one is right for clone.
242+
;; (#insertion-delimiter! @branch "")
243+
)
244+
245+
[
246+
(type_switch_statement)
247+
(expression_switch_statement)
248+
] @branch.iteration
249+
250+
;; TODO: if-then-else branches? They're rare in Go.
251+
;; TODO: in `case x, y, z:`, should x/y/z be values? names?
252+
;; what about type switch cases: should they be types?
253+
;; TODO: teach condition about switch statement conditions

0 commit comments

Comments
 (0)