Skip to content

Commit bfe1893

Browse files
Replace private.switchStatementSubject with value scope (#2999)
* We're already using `value` for the collection in for-each statements: - https://github.com/cursorless-dev/cursorless/blob/d55c744091394d8840a17e04ef8b7d21f03068b3/data/fixtures/scopes/javascript.core/value.foreach.scope * Most of the tree sitter parsers call this field `value`. The other alternative that's commonly used is `condition`, but we're already using that in switch cases and I want to avoid conflicts. - https://github.com/cursorless-dev/cursorless/blob/d55c744091394d8840a17e04ef8b7d21f03068b3/queries/javascript.core.scm#L614 Since this scope is private we're not going to do any migration or deprecation. It will just be removed. The this pull requests adds `value` scope support for the switch subject though. With that said I'm going to leave this open for a week in case someone has input.
1 parent 38ff031 commit bfe1893

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+132
-212
lines changed

cursorless-talon/src/spoken_forms.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ def handle_new_values(csv_name: str, values: list[SpokenFormEntry]):
156156
],
157157
extra_allowed_values=[
158158
"private.fieldAccess",
159-
"private.switchStatementSubject",
160159
"textFragment",
161160
"disqualifyDelimiter",
162161
"pairDelimiter",

data/fixtures/recorded/languages/cpp/clearSubject.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
languageId: cpp
22
command:
33
version: 6
4-
spokenForm: change subject
4+
spokenForm: change value
55
action:
66
name: clearAndSetSelection
77
target:
88
type: primitive
99
modifiers:
1010
- type: containingScope
11-
scopeType: {type: private.switchStatementSubject}
11+
scopeType: {type: value}
1212
usePrePhraseSnapshot: true
13-
spokenFormError: >-
14-
simple scope type type with id private.switchStatementSubject; this is a
15-
private spoken form currently only for internal experimentation
1613
initialState:
1714
documentContents: |
1815
int main() {

data/fixtures/recorded/languages/cpp/clearSubject2.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
languageId: cpp
22
command:
33
version: 6
4-
spokenForm: change subject
4+
spokenForm: change value
55
action:
66
name: clearAndSetSelection
77
target:
88
type: primitive
99
modifiers:
1010
- type: containingScope
11-
scopeType: {type: private.switchStatementSubject}
11+
scopeType: {type: value}
1212
usePrePhraseSnapshot: false
13-
spokenFormError: >-
14-
simple scope type type with id private.switchStatementSubject; this is a
15-
private spoken form currently only for internal experimentation
1613
initialState:
1714
documentContents: |
1815
int main() {

data/fixtures/recorded/languages/java/clearSubject.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
languageId: java
22
command:
33
version: 6
4-
spokenForm: change subject
4+
spokenForm: change value
55
action:
66
name: clearAndSetSelection
77
target:
88
type: primitive
99
modifiers:
1010
- type: containingScope
11-
scopeType: {type: private.switchStatementSubject}
11+
scopeType: {type: value}
1212
usePrePhraseSnapshot: true
13-
spokenFormError: >-
14-
simple scope type type with id private.switchStatementSubject; this is a
15-
private spoken form currently only for internal experimentation
1613
initialState:
1714
documentContents: |
1815
class Aaa {

data/fixtures/recorded/languages/java/clearSubject2.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
languageId: java
22
command:
33
version: 6
4-
spokenForm: change subject
4+
spokenForm: change value
55
action:
66
name: clearAndSetSelection
77
target:
88
type: primitive
99
modifiers:
1010
- type: containingScope
11-
scopeType: {type: private.switchStatementSubject}
11+
scopeType: {type: value}
1212
usePrePhraseSnapshot: true
13-
spokenFormError: >-
14-
simple scope type type with id private.switchStatementSubject; this is a
15-
private spoken form currently only for internal experimentation
1613
initialState:
1714
documentContents: |
1815
class Aaa {

data/fixtures/recorded/languages/python/clearSubject.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
languageId: python
22
command:
33
version: 6
4-
spokenForm: change subject
4+
spokenForm: change value
55
action:
66
name: clearAndSetSelection
77
target:
88
type: primitive
99
modifiers:
1010
- type: containingScope
11-
scopeType: {type: private.switchStatementSubject}
11+
scopeType: {type: value}
1212
usePrePhraseSnapshot: true
13-
spokenFormError: >-
14-
simple scope type type with id private.switchStatementSubject; this is a
15-
private spoken form currently only for internal experimentation
1613
initialState:
1714
documentContents: |
1815
match 0:

data/fixtures/recorded/languages/rust/changeSubject.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
languageId: rust
22
command:
33
version: 6
4-
spokenForm: change subject
4+
spokenForm: change value
55
action:
66
name: clearAndSetSelection
77
target:
88
type: primitive
99
modifiers:
1010
- type: containingScope
11-
scopeType: {type: private.switchStatementSubject}
11+
scopeType: {type: value}
1212
usePrePhraseSnapshot: true
13-
spokenFormError: >-
14-
simple scope type type with id private.switchStatementSubject; this is a
15-
private spoken form currently only for internal experimentation
1613
initialState:
1714
documentContents: |
1815
match user {

data/fixtures/recorded/languages/scala/clearSubject.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
languageId: scala
22
command:
33
version: 6
4-
spokenForm: change subject
4+
spokenForm: change value
55
action:
66
name: clearAndSetSelection
77
target:
88
type: primitive
99
modifiers:
1010
- type: containingScope
11-
scopeType: {type: private.switchStatementSubject}
11+
scopeType: {type: value}
1212
usePrePhraseSnapshot: true
13-
spokenFormError: >-
14-
simple scope type type with id private.switchStatementSubject; this is a
15-
private spoken form currently only for internal experimentation
1613
initialState:
1714
documentContents: |
1815
def matchTest(x: Int): String = x match {

data/fixtures/recorded/languages/typescript/clearSubject.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
languageId: typescript
22
command:
33
version: 6
4-
spokenForm: change subject
4+
spokenForm: change value
55
action:
66
name: clearAndSetSelection
77
target:
88
type: primitive
99
modifiers:
1010
- type: containingScope
11-
scopeType: {type: private.switchStatementSubject}
11+
scopeType: {type: value}
1212
usePrePhraseSnapshot: true
13-
spokenFormError: >-
14-
simple scope type type with id private.switchStatementSubject; this is a
15-
private spoken form currently only for internal experimentation
1613
initialState:
1714
documentContents: |-
1815
switch(aaa) {

data/fixtures/recorded/languages/typescript/clearSubject2.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
languageId: typescript
22
command:
33
version: 6
4-
spokenForm: change subject
4+
spokenForm: change value
55
action:
66
name: clearAndSetSelection
77
target:
88
type: primitive
99
modifiers:
1010
- type: containingScope
11-
scopeType: {type: private.switchStatementSubject}
11+
scopeType: {type: value}
1212
usePrePhraseSnapshot: true
13-
spokenFormError: >-
14-
simple scope type type with id private.switchStatementSubject; this is a
15-
private spoken form currently only for internal experimentation
1613
initialState:
1714
documentContents: |-
1815
switch(aaa + 1) {

0 commit comments

Comments
 (0)