Skip to content

Commit

Permalink
go scope migration (#2340)
Browse files Browse the repository at this point in the history
## 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 <[email protected]>
  • Loading branch information
AndreasArvidsson and pokey authored Jun 14, 2024
1 parent d2a1845 commit 5f94e08
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export const legacyLanguageIds = [
"clojure",
"csharp",
"css",
"go",
"latex",
"markdown",
"php",
Expand Down
2 changes: 0 additions & 2 deletions packages/cursorless-engine/src/languages/getNodeMatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { selectionWithEditorFromRange } from "../util/selectionUtils";
import clojure from "./clojure";
import { LegacyLanguageId } from "./LegacyLanguageId";
import csharp from "./csharp";
import go from "./go";
import latex from "./latex";
import markdown from "./markdown";
import php from "./php";
Expand Down Expand Up @@ -52,7 +51,6 @@ export const languageMatchers: Record<
clojure,
csharp,
css: scss,
go,
latex,
markdown,
php,
Expand Down
37 changes: 0 additions & 37 deletions packages/cursorless-engine/src/languages/go.ts

This file was deleted.

91 changes: 91 additions & 0 deletions queries/go.scm
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,94 @@
(if_statement) @branch.iteration
(#not-parent-type? @branch.iteration if_statement)
)

(if_statement) @ifStatement

[
(call_expression)
(composite_literal)
] @functionCall

(call_expression
function: (_) @functionCallee
) @_.domain
(composite_literal
type: (_) @functionCallee
) @_.domain

(keyed_element
.
(_) @collectionKey
.
(_) @value
) @_.domain

(return_statement
(expression_list) @value
) @_.domain

(literal_value) @collectionKey.iteration @value.iteration

[
(pointer_type)
(qualified_type)
(type_identifier)
] @type

(function_declaration
result: (_) @type
) @_.domain
(method_declaration
result: (_) @type
) @_.domain

;;!! if true {}
(
(_
condition: (_) @condition
) @_.domain
(#not-type? @condition parenthesized_expression)
)

;;!! if (true) {}
(
(_
condition: (parenthesized_expression) @condition
) @_.domain
(#child-range! @condition 0 -1 true true)
)

;;!! func add(x int, y int) int {}
(
(parameter_list
(_)? @_.leading.endOf
.
(_) @argumentOrParameter
.
(_)? @_.trailing.startOf
) @_dummy
(#not-type? @argumentOrParameter "comment")
(#single-or-multi-line-delimiter! @argumentOrParameter @_dummy ", " ",\n")
)

;;!! add(1, 2)
(
(argument_list
(_)? @_.leading.endOf
.
(_) @argumentOrParameter
.
(_)? @_.trailing.startOf
) @_dummy
(#not-type? @argumentOrParameter "comment")
(#single-or-multi-line-delimiter! @argumentOrParameter @_dummy ", " ",\n")
)

(parameter_list
"(" @argumentOrParameter.iteration.start.endOf
")" @argumentOrParameter.iteration.end.startOf
) @argumentOrParameter.iteration.domain
(argument_list
"(" @argumentOrParameter.iteration.start.endOf
")" @argumentOrParameter.iteration.end.startOf
) @argumentOrParameter.iteration.domain

0 comments on commit 5f94e08

Please sign in to comment.