Skip to content

Commit 5f94e08

Browse files
go scope migration (#2340)
## Checklist - [/] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [/] 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) - [/] I have not broken the cheatsheet --------- Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>
1 parent d2a1845 commit 5f94e08

File tree

4 files changed

+91
-40
lines changed

4 files changed

+91
-40
lines changed

packages/cursorless-engine/src/languages/LegacyLanguageId.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export const legacyLanguageIds = [
66
"clojure",
77
"csharp",
88
"css",
9-
"go",
109
"latex",
1110
"markdown",
1211
"php",

packages/cursorless-engine/src/languages/getNodeMatcher.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { selectionWithEditorFromRange } from "../util/selectionUtils";
1111
import clojure from "./clojure";
1212
import { LegacyLanguageId } from "./LegacyLanguageId";
1313
import csharp from "./csharp";
14-
import go from "./go";
1514
import latex from "./latex";
1615
import markdown from "./markdown";
1716
import php from "./php";
@@ -52,7 +51,6 @@ export const languageMatchers: Record<
5251
clojure,
5352
csharp,
5453
css: scss,
55-
go,
5654
latex,
5755
markdown,
5856
php,

packages/cursorless-engine/src/languages/go.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

queries/go.scm

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,3 +277,94 @@
277277
(if_statement) @branch.iteration
278278
(#not-parent-type? @branch.iteration if_statement)
279279
)
280+
281+
(if_statement) @ifStatement
282+
283+
[
284+
(call_expression)
285+
(composite_literal)
286+
] @functionCall
287+
288+
(call_expression
289+
function: (_) @functionCallee
290+
) @_.domain
291+
(composite_literal
292+
type: (_) @functionCallee
293+
) @_.domain
294+
295+
(keyed_element
296+
.
297+
(_) @collectionKey
298+
.
299+
(_) @value
300+
) @_.domain
301+
302+
(return_statement
303+
(expression_list) @value
304+
) @_.domain
305+
306+
(literal_value) @collectionKey.iteration @value.iteration
307+
308+
[
309+
(pointer_type)
310+
(qualified_type)
311+
(type_identifier)
312+
] @type
313+
314+
(function_declaration
315+
result: (_) @type
316+
) @_.domain
317+
(method_declaration
318+
result: (_) @type
319+
) @_.domain
320+
321+
;;!! if true {}
322+
(
323+
(_
324+
condition: (_) @condition
325+
) @_.domain
326+
(#not-type? @condition parenthesized_expression)
327+
)
328+
329+
;;!! if (true) {}
330+
(
331+
(_
332+
condition: (parenthesized_expression) @condition
333+
) @_.domain
334+
(#child-range! @condition 0 -1 true true)
335+
)
336+
337+
;;!! func add(x int, y int) int {}
338+
(
339+
(parameter_list
340+
(_)? @_.leading.endOf
341+
.
342+
(_) @argumentOrParameter
343+
.
344+
(_)? @_.trailing.startOf
345+
) @_dummy
346+
(#not-type? @argumentOrParameter "comment")
347+
(#single-or-multi-line-delimiter! @argumentOrParameter @_dummy ", " ",\n")
348+
)
349+
350+
;;!! add(1, 2)
351+
(
352+
(argument_list
353+
(_)? @_.leading.endOf
354+
.
355+
(_) @argumentOrParameter
356+
.
357+
(_)? @_.trailing.startOf
358+
) @_dummy
359+
(#not-type? @argumentOrParameter "comment")
360+
(#single-or-multi-line-delimiter! @argumentOrParameter @_dummy ", " ",\n")
361+
)
362+
363+
(parameter_list
364+
"(" @argumentOrParameter.iteration.start.endOf
365+
")" @argumentOrParameter.iteration.end.startOf
366+
) @argumentOrParameter.iteration.domain
367+
(argument_list
368+
"(" @argumentOrParameter.iteration.start.endOf
369+
")" @argumentOrParameter.iteration.end.startOf
370+
) @argumentOrParameter.iteration.domain

0 commit comments

Comments
 (0)