Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added scope type for "inside" #2776

Merged
merged 47 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
a669ea2
Create interior scope
AndreasArvidsson Jan 26, 2025
bacfe2a
More migrations
AndreasArvidsson Jan 26, 2025
5026b89
Added test
AndreasArvidsson Jan 26, 2025
57f50b1
Fixes
AndreasArvidsson Jan 26, 2025
c76b06c
Changed to main
AndreasArvidsson Jan 26, 2025
261bf5c
Clean up
AndreasArvidsson Jan 26, 2025
fd17e7c
Use interior target
AndreasArvidsson Jan 26, 2025
df0c5ab
More testing
AndreasArvidsson Jan 26, 2025
16895d9
Update query
AndreasArvidsson Jan 26, 2025
b573ebc
update tests
AndreasArvidsson Jan 26, 2025
f51daaf
Rename
AndreasArvidsson Jan 26, 2025
c8e3d08
Clean up
AndreasArvidsson Jan 26, 2025
f224844
Merge branch 'main' into interiorScope
AndreasArvidsson Jan 28, 2025
edb1686
Update test
AndreasArvidsson Jan 28, 2025
eb2e10c
Added tests
AndreasArvidsson Jan 29, 2025
2fe2d06
Refactoring
AndreasArvidsson Jan 29, 2025
1d28b12
Refactor
AndreasArvidsson Jan 29, 2025
bdea847
Simplification
AndreasArvidsson Jan 29, 2025
3f95faf
Update test
AndreasArvidsson Jan 29, 2025
d558ac7
More fixes
AndreasArvidsson Jan 30, 2025
ac36859
Added comments
AndreasArvidsson Jan 30, 2025
0fb7d86
Update comments
AndreasArvidsson Jan 30, 2025
b8565a7
More cleanup
AndreasArvidsson Jan 30, 2025
7a9620f
More clean up
AndreasArvidsson Jan 30, 2025
913f8e8
padding
AndreasArvidsson Jan 30, 2025
40540dc
comment
AndreasArvidsson Jan 30, 2025
3da4d51
Fix
AndreasArvidsson Jan 30, 2025
9742579
Refactoring
AndreasArvidsson Jan 30, 2025
c107e8a
unused code
AndreasArvidsson Jan 30, 2025
1f92e81
type import
AndreasArvidsson Jan 30, 2025
2bf2496
Added textual interior scope test
AndreasArvidsson Jan 30, 2025
93e46b0
Rename
AndreasArvidsson Jan 30, 2025
827ebf1
Merge branch 'main' into interiorScope
AndreasArvidsson Jan 30, 2025
65c9e11
Merge branch 'main' into interiorScope
AndreasArvidsson Jan 30, 2025
7077448
Merge branch 'main' into interiorScope
phillco Jan 30, 2025
b9d1dad
Apply suggestions from code review
phillco Jan 30, 2025
eade3b5
Update packages/cursorless-engine/src/processTargets/modifiers/scopeH…
phillco Jan 30, 2025
7d9d5fe
Merge branch 'main' into interiorScope
AndreasArvidsson Jan 30, 2025
7ae7b30
Merge branch 'interiorScope' of github.com:cursorless-dev/cursorless …
AndreasArvidsson Jan 30, 2025
dc32fc8
Update comments
AndreasArvidsson Jan 30, 2025
111b40c
cleanup
AndreasArvidsson Jan 30, 2025
5c444eb
revert comments
AndreasArvidsson Jan 30, 2025
de5d624
Update packages/cursorless-engine/src/processTargets/modifiers/scopeH…
phillco Jan 30, 2025
bd096f8
Update packages/cursorless-engine/src/processTargets/modifiers/scopeH…
phillco Jan 30, 2025
7f03ae6
Merge branch 'main' into interiorScope
phillco Jan 30, 2025
39ab576
Merge branch 'main' into interiorScope
AndreasArvidsson Jan 30, 2025
2678ffc
Merge fix
AndreasArvidsson Jan 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cursorless-talon/src/spoken_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ def handle_new_values(csv_name: str, values: list[SpokenFormEntry]):
"textFragment",
"disqualifyDelimiter",
"pairDelimiter",
"interior",
],
default_list_name="scope_type",
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,4 @@ initialState:
- anchor: {line: 0, character: 1}
active: {line: 0, character: 1}
marks: {}
finalState:
documentContents: ()
selections:
- anchor: {line: 0, character: 1}
active: {line: 0, character: 1}
thrownError: {name: NoContainingScopeError}
26 changes: 26 additions & 0 deletions data/fixtures/recorded/modifiers/changeInside.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
languageId: python
command:
version: 7
spokenForm: change inside
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- {type: interiorOnly}
usePrePhraseSnapshot: false
initialState:
documentContents: |-
def testing():
pass
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
marks: {}
finalState:
documentContents: |-
def testing():

selections:
- anchor: {line: 1, character: 4}
active: {line: 1, character: 4}
22 changes: 22 additions & 0 deletions data/fixtures/recorded/modifiers/interior/changeInside.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
languageId: html
command:
version: 7
spokenForm: change inside
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- {type: interiorOnly}
usePrePhraseSnapshot: false
initialState:
documentContents: <div>content</div>
selections:
- anchor: {line: 0, character: 1}
active: {line: 0, character: 1}
marks: {}
finalState:
documentContents: <>content</div>
selections:
- anchor: {line: 0, character: 1}
active: {line: 0, character: 1}
22 changes: 22 additions & 0 deletions data/fixtures/recorded/modifiers/interior/changeInside2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
languageId: html
command:
version: 7
spokenForm: change inside
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- {type: interiorOnly}
usePrePhraseSnapshot: false
initialState:
documentContents: <div>content</div>
selections:
- anchor: {line: 0, character: 9}
active: {line: 0, character: 9}
marks: {}
finalState:
documentContents: <div></div>
selections:
- anchor: {line: 0, character: 5}
active: {line: 0, character: 5}
22 changes: 22 additions & 0 deletions data/fixtures/recorded/modifiers/interior/changeInside3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
languageId: plaintext
command:
version: 7
spokenForm: change inside
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- {type: interiorOnly}
usePrePhraseSnapshot: false
initialState:
documentContents: (hello)
selections:
- anchor: {line: 0, character: 3}
active: {line: 0, character: 3}
marks: {}
finalState:
documentContents: ()
selections:
- anchor: {line: 0, character: 1}
active: {line: 0, character: 1}
22 changes: 22 additions & 0 deletions data/fixtures/recorded/modifiers/interior/changeInside4.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
languageId: html
command:
version: 7
spokenForm: change inside
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- {type: interiorOnly}
usePrePhraseSnapshot: false
initialState:
documentContents: <div>content</div> (hello)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be neat if this would give you this:

<div>|</div> (|)

selections:
- anchor: {line: 0, character: 8}
active: {line: 0, character: 23}
marks: {}
finalState:
documentContents: <div>)
selections:
- anchor: {line: 0, character: 5}
active: {line: 0, character: 5}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
languageId: html
command:
version: 7
spokenForm: change inside element
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- {type: interiorOnly}
- type: containingScope
scopeType: {type: xmlElement}
usePrePhraseSnapshot: false
initialState:
documentContents: <div>content</div>
selections:
- anchor: {line: 0, character: 1}
active: {line: 0, character: 1}
marks: {}
finalState:
documentContents: <div></div>
selections:
- anchor: {line: 0, character: 5}
active: {line: 0, character: 5}
12 changes: 4 additions & 8 deletions data/fixtures/scopes/html/element.scope
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
<div id="root"></div>
<div id="root">text</div>
---

[Content] =
[Removal] =
[Domain] = 0:0-0:21
>---------------------<
0| <div id="root"></div>

[Interior] = 0:15-0:15
><
0| <div id="root"></div>
[Domain] = 0:0-0:25
>-------------------------<
0| <div id="root">text</div>

[Insertion delimiter] = "\n"
40 changes: 40 additions & 0 deletions data/fixtures/scopes/html/interior.element.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<div> text </div>
---

[#1 Content] =
[#1 Removal] = 0:1-0:4
>---<
0| <div> text </div>

[#1 Domain] = 0:0-0:5
>-----<
0| <div> text </div>

[#1 Insertion delimiter] = " "


[#2 Content] = 0:6-0:10
>----<
0| <div> text </div>

[#2 Removal] = 0:5-0:11
>------<
0| <div> text </div>

[#2 Domain] = 0:0-0:17
>-----------------<
0| <div> text </div>

[#2 Insertion delimiter] = " "


[#3 Content] =
[#3 Removal] = 0:13-0:16
>---<
0| <div> text </div>

[#3 Domain] = 0:11-0:17
>------<
0| <div> text </div>

[#3 Insertion delimiter] = " "
12 changes: 4 additions & 8 deletions data/fixtures/scopes/javascript.jsx/element.scope
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
<div id="root"></div>
<div id="root">text</div>
---

[Content] =
[Removal] =
[Domain] = 0:0-0:21
>---------------------<
0| <div id="root"></div>

[Interior] = 0:15-0:15
><
0| <div id="root"></div>
[Domain] = 0:0-0:25
>-------------------------<
0| <div id="root">text</div>

[Insertion delimiter] = "\n"
40 changes: 40 additions & 0 deletions data/fixtures/scopes/javascript.jsx/interior.element.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<div> text </div>
---

[#1 Content] =
[#1 Removal] = 0:1-0:4
>---<
0| <div> text </div>

[#1 Domain] = 0:0-0:5
>-----<
0| <div> text </div>

[#1 Insertion delimiter] = " "


[#2 Content] = 0:6-0:10
>----<
0| <div> text </div>

[#2 Removal] = 0:5-0:11
>------<
0| <div> text </div>

[#2 Domain] = 0:0-0:17
>-----------------<
0| <div> text </div>

[#2 Insertion delimiter] = " "


[#3 Content] =
[#3 Removal] = 0:13-0:16
>---<
0| <div> text </div>

[#3 Domain] = 0:11-0:17
>------<
0| <div> text </div>

[#3 Insertion delimiter] = " "
10 changes: 0 additions & 10 deletions data/fixtures/scopes/latex/element.scope
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,4 @@
2| \end{quote}
-----------<

[Interior: Content] = 1:4-1:9
>-----<
1| Hello
[Interior: Removal] = 0:13-2:0
>
0| \begin{quote}
1| Hello
2| \end{quote}
<

[Insertion delimiter] = "\n"
10 changes: 0 additions & 10 deletions data/fixtures/scopes/latex/environment.scope
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,4 @@
2| \end{quote}
-----------<

[Interior: Content] = 1:4-1:9
>-----<
1| Hello
[Interior: Removal] = 0:13-2:0
>
0| \begin{quote}
1| Hello
2| \end{quote}
<

[Insertion delimiter] = "\n"
48 changes: 48 additions & 0 deletions data/fixtures/scopes/latex/interior.element.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
\begin{quote}
Hello
\end{quote}
---

[#1 Content] = 1:4-1:9
>-----<
1| Hello

[#1 Removal] = 0:13-2:0
>
0| \begin{quote}
1| Hello
2| \end{quote}
<

[#1 Domain] = 0:0-2:11
>-------------
0| \begin{quote}
1| Hello
2| \end{quote}
-----------<

[#1 Insertion delimiter] = " "


[#2 Content] =
[#2 Removal] = 0:7-0:12
>-----<
0| \begin{quote}

[#2 Domain] = 0:6-0:13
>-------<
0| \begin{quote}

[#2 Insertion delimiter] = " "


[#3 Content] =
[#3 Removal] = 2:5-2:10
>-----<
2| \end{quote}

[#3 Domain] = 2:4-2:11
>-------<
2| \end{quote}

[#3 Insertion delimiter] = " "
12 changes: 0 additions & 12 deletions data/fixtures/scopes/lua/branch.if.scope
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ end
2| elseif x > y then
<

[#1 Interior] = 1:4-1:29
>-------------------------<
1| print("x is less than y")

[#1 Insertion delimiter] = "\n"


Expand All @@ -42,10 +38,6 @@ end
4| else
<

[#2 Interior] = 3:4-3:32
>----------------------------<
3| print("x is greater than y")

[#2 Insertion delimiter] = "\n"


Expand All @@ -63,8 +55,4 @@ end
6| end
<

[#3 Interior] = 5:4-5:28
>------------------------<
5| print("x is equal to y")

[#3 Insertion delimiter] = "\n"
Loading
Loading