-
-
Notifications
You must be signed in to change notification settings - Fork 81
Language: Go
This page is about Go-related Cursorless tips and quirks. It will eventually be subsumed by a Go docs page.
For the most part, Go is like any other Cursorless-supported language, and the first port of call is the main Cursorless documentation.
Cursorless considers any composite literal that contains any indexed element to be a map. That includes maps (map[string]int{"a": 2}
), structs using field names (T{a: 2}
), and arrays and structs with numeric indices ([256]bool{58: true}
). It also includes {}
.
Similarly, Cursorless considers any composite literal that contains any non-indexed element to be a list. That includes slices and arrays ([]int{2}
and structs not using field names (T{2}
). It also includes {}
.
For the rationale, see: https://github.com/cursorless-dev/cursorless/blob/4588044dcc0d73d5507ff0cbf1dcd2ea988ffd6b/queries/go.scm#L39-L78
Funk refers to any func or method, generic or not, including both declared (func f() {}
) and anonymous ones (f := func(){}
or go func(){}
). Lambda only refers to anonymous functions.
For a discussion, see: https://github.com/cursorless-dev/cursorless/pull/1756