Skip to content

Commit

Permalink
Automatically expand removal for Tree sitter targets (#2783)
Browse files Browse the repository at this point in the history
Fixes #855

## 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: Phil Cohen <phillip@phillip.io>
  • Loading branch information
AndreasArvidsson and phillco authored Jan 29, 2025
1 parent 14e6c58 commit 3266cc7
Show file tree
Hide file tree
Showing 67 changed files with 627 additions and 167 deletions.
1 change: 0 additions & 1 deletion data/fixtures/recorded/itemTextual/chuckItem2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ initialState:
finalState:
documentContents: |-
[
]
selections:
- anchor: {line: 1, character: 0}
Expand Down
3 changes: 1 addition & 2 deletions data/fixtures/recorded/languages/css/chuckState2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ initialState:
active: {line: 0, character: 2}
marks: {}
finalState:
documentContents: |+
documentContents: ""
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
1 change: 0 additions & 1 deletion data/fixtures/recorded/languages/ruby/chuckState.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ initialState:
finalState:
documentContents: |-
if true
end
selections:
- anchor: {line: 1, character: 0}
Expand Down
1 change: 0 additions & 1 deletion data/fixtures/recorded/languages/ruby/chuckState10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ finalState:
begin
a = 10
ensure
end
selections:
- anchor: {line: 3, character: 0}
Expand Down
1 change: 0 additions & 1 deletion data/fixtures/recorded/languages/ruby/chuckState11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ finalState:
begin
a = 10
else
ensure
a = 10
end
Expand Down
1 change: 0 additions & 1 deletion data/fixtures/recorded/languages/ruby/chuckState2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ initialState:
finalState:
documentContents: |-
while true do
end
selections:
- anchor: {line: 1, character: 0}
Expand Down
1 change: 0 additions & 1 deletion data/fixtures/recorded/languages/ruby/chuckState3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ initialState:
finalState:
documentContents: |-
[].each do |i|
end
selections:
- anchor: {line: 1, character: 0}
Expand Down
1 change: 0 additions & 1 deletion data/fixtures/recorded/languages/ruby/chuckState4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ initialState:
finalState:
documentContents: |-
[].each { |i|
}
selections:
- anchor: {line: 1, character: 0}
Expand Down
1 change: 0 additions & 1 deletion data/fixtures/recorded/languages/ruby/chuckState5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ initialState:
finalState:
documentContents: |-
begin
end until true
selections:
- anchor: {line: 1, character: 0}
Expand Down
1 change: 0 additions & 1 deletion data/fixtures/recorded/languages/ruby/chuckState7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ finalState:
documentContents: |-
case abc
when true
else
a = 10
end
Expand Down
1 change: 0 additions & 1 deletion data/fixtures/recorded/languages/ruby/chuckState8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ finalState:
when true
a = 0
else
end
selections:
- anchor: {line: 4, character: 0}
Expand Down
1 change: 0 additions & 1 deletion data/fixtures/recorded/languages/ruby/chuckState9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ initialState:
finalState:
documentContents: |-
begin
ensure
a = 10
end
Expand Down
7 changes: 3 additions & 4 deletions data/fixtures/recorded/languages/rust/chuckFunkMade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ initialState:
start: {line: 0, character: 3}
end: {line: 0, character: 7}
finalState:
documentContents: |+
documentContents: ""
selections:
- anchor: {line: 1, character: 0}
active: {line: 1, character: 0}
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
3 changes: 1 addition & 2 deletions data/fixtures/recorded/languages/rust/chuckState.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ initialState:
active: {line: 0, character: 10}
marks: {}
finalState:
documentContents: |+
documentContents: ""
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
6 changes: 2 additions & 4 deletions data/fixtures/recorded/languages/rust/chuckTypeAir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ initialState:
end: {line: 0, character: 5}
finalState:
documentContents: |
impl T for Option<u32> {
fn f() {
unimplemented!()
}
}
selections:
- anchor: {line: 6, character: 0}
active: {line: 6, character: 0}
- anchor: {line: 4, character: 0}
active: {line: 4, character: 0}
8 changes: 3 additions & 5 deletions data/fixtures/recorded/languages/rust/chuckTypeMade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ initialState:
start: {line: 4, character: 0}
end: {line: 4, character: 4}
finalState:
documentContents: |+
documentContents: |
trait T {
fn f();
}
selections:
- anchor: {line: 4, character: 0}
active: {line: 4, character: 0}
- anchor: {line: 3, character: 0}
active: {line: 3, character: 0}
5 changes: 2 additions & 3 deletions data/fixtures/recorded/languages/scala/chuckBranchSun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ finalState:
documentContents: |
def matchTest(x: Int): String = x match {
case 0 => "zero"
case 2 => "two"
case _ => "other"
}
selections:
- anchor: {line: 3, character: 2}
active: {line: 4, character: 2}
- anchor: {line: 2, character: 2}
active: {line: 3, character: 2}
3 changes: 1 addition & 2 deletions data/fixtures/recorded/languages/scss/chuckState2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ initialState:
active: {line: 0, character: 4}
marks: {}
finalState:
documentContents: |+
documentContents: ""
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
1 change: 0 additions & 1 deletion data/fixtures/recorded/languages/typescript/chuckState.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ initialState:
finalState:
documentContents: |-
interface Foo {
baz: Baz;
}
selections:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ initialState:
finalState:
documentContents: |-
class Foo {
}
selections:
- anchor: {line: 1, character: 0}
Expand Down
1 change: 0 additions & 1 deletion data/fixtures/recorded/languages/typescript/ditchFunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ finalState:
abstract class Foo {
protected abstract bar(): void;
baz() {}
}
selections:
Expand Down
1 change: 0 additions & 1 deletion data/fixtures/recorded/languages/typescript/ditchFunk2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ initialState:
finalState:
documentContents: |-
abstract class Foo {
}
selections:
- anchor: {line: 1, character: 0}
Expand Down
7 changes: 3 additions & 4 deletions data/fixtures/recorded/languages/yaml/chuckItem11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ initialState:
active: {line: 1, character: 2}
marks: {}
finalState:
documentContents: |
foo:
documentContents: "foo:"
selections:
- anchor: {line: 1, character: 0}
active: {line: 1, character: 0}
- anchor: {line: 0, character: 4}
active: {line: 0, character: 4}
42 changes: 36 additions & 6 deletions data/fixtures/scopes/c/class.scope
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,84 @@ typedef enum { jjj, kkk } lll;
---

[#1 Content] =
[#1 Removal] =
[#1 Domain] = 0:0-0:24
>------------------------<
0| struct aaa { int bbb; };

[#1 Removal] = 0:0-1:0
>------------------------
0| struct aaa { int bbb; };
1| union bbb { int ccc; };
<

[#1 Insertion delimiter] = "\n\n"


[#2 Content] =
[#2 Removal] =
[#2 Domain] = 1:0-1:23
>-----------------------<
1| union bbb { int ccc; };

[#2 Removal] = 1:0-2:0
>-----------------------
1| union bbb { int ccc; };
2| enum ccc { ddd, eee };
<

[#2 Insertion delimiter] = "\n\n"


[#3 Content] =
[#3 Removal] =
[#3 Domain] = 2:0-2:22
>----------------------<
2| enum ccc { ddd, eee };

[#3 Removal] = 2:0-3:0
>----------------------
2| enum ccc { ddd, eee };
3|
<

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


[#4 Content] =
[#4 Removal] =
[#4 Domain] = 4:0-4:32
>--------------------------------<
4| typedef struct { int fff; } ggg;

[#4 Removal] = 4:0-5:0
>--------------------------------
4| typedef struct { int fff; } ggg;
5| typedef union { int hhh; } iii;
<

[#4 Insertion delimiter] = "\n\n"


[#5 Content] =
[#5 Removal] =
[#5 Domain] = 5:0-5:31
>-------------------------------<
5| typedef union { int hhh; } iii;

[#5 Removal] = 5:0-6:0
>-------------------------------
5| typedef union { int hhh; } iii;
6| typedef enum { jjj, kkk } lll;
<

[#5 Insertion delimiter] = "\n\n"


[#6 Content] =
[#6 Removal] =
[#6 Domain] = 6:0-6:30
>------------------------------<
6| typedef enum { jjj, kkk } lll;

[#6 Removal] = 5:31-6:30
>
5| typedef union { int hhh; } iii;
6| typedef enum { jjj, kkk } lll;
------------------------------<

[#6 Insertion delimiter] = "\n\n"
6 changes: 4 additions & 2 deletions data/fixtures/scopes/c/ifStatement.scope
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ void func() {
>-------------<
1| if (true) { }

[Removal] = 1:0-1:17
>-----------------<
[Removal] = 1:0-2:0
>-----------------
1| if (true) { }
2| }
<

[Leading delimiter] = 1:0-1:4
>----<
Expand Down
Loading

0 comments on commit 3266cc7

Please sign in to comment.