Skip to content

Commit e61045c

Browse files
scala scope migration (#2345)
## 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
1 parent 008baa1 commit e61045c

File tree

2 files changed

+33
-17
lines changed

2 files changed

+33
-17
lines changed

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,6 @@ import { childRangeSelector } from "../util/nodeSelectors";
1313
const nodeMatchers: Partial<
1414
Record<SimpleScopeTypeType, NodeMatcherAlternative>
1515
> = {
16-
// treating classes = classlike
17-
class: ["class_definition", "object_definition", "trait_definition"],
18-
className: [
19-
"class_definition[name]",
20-
"object_definition[name]",
21-
"trait_definition[name]",
22-
],
23-
24-
// list.size(), does not count foo.size (field_expression), or foo size (postfix_expression)
25-
functionCall: "call_expression",
26-
namedFunction: "function_definition",
27-
anonymousFunction: "lambda_expression",
28-
2916
argumentOrParameter: argumentMatcher(
3017
"arguments",
3118
"parameters",
@@ -39,10 +26,6 @@ const nodeMatchers: Partial<
3926
}),
4027
),
4128

42-
["private.switchStatementSubject"]: "match_expression[value]",
43-
name: ["*[name]", "*[pattern]"],
44-
functionName: "function_definition[name]",
45-
4629
// *[type] does not work here because while we want most of these we don't want "compound" types,
4730
// eg `generic_type[type]`, because that will grab just the inner generic (the String of List[String])
4831
// and as a rule we want to grab entire type definitions.

queries/scala.scm

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,36 @@
66
] @string @textFragment
77

88
(comment) @comment @textFragment
9+
10+
;; treating classes = classlike
11+
[
12+
(class_definition
13+
name: (_) @className
14+
)
15+
(object_definition
16+
name: (_) @className
17+
)
18+
(trait_definition
19+
name: (_) @className
20+
)
21+
] @class @className.domain
22+
23+
;; list.size(), does not count foo.size (field_expression), or foo size (postfix_expression)
24+
(call_expression) @functionCall
25+
26+
(lambda_expression) @anonymousFunction
27+
28+
(function_definition
29+
name: (_) @functionName
30+
) @namedFunction @functionName.domain
31+
32+
(match_expression
33+
value: (_) @private.switchStatementSubject
34+
) @_.domain
35+
36+
(_
37+
name: (_) @name
38+
) @_.domain
39+
(_
40+
pattern: (_) @name
41+
) @_.domain

0 commit comments

Comments
 (0)