Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
dfe9fcd
Enable initial r support
Dec 28, 2024
35f3646
intial supported queries
BlueDrink9 Feb 23, 2025
2642bf6
add initial bunch of r scopes
BlueDrink9 May 15, 2025
84600ff
(r) clean up facet list
BlueDrink9 May 17, 2025
f8a9222
r: Update tests to include assignment operators
BlueDrink9 May 22, 2025
4bc8d4f
Correct name and value scopes and queries
BlueDrink9 May 22, 2025
d34e880
fix namedFunction query
BlueDrink9 May 22, 2025
c1b1199
Fix function names scope and tests
BlueDrink9 May 22, 2025
c41875b
Split argument and parameter scope tests and include delimiter inquiry
BlueDrink9 May 23, 2025
019b000
Split up if statement scope tests
BlueDrink9 May 23, 2025
bd59837
Merge branch 'main' into main
BlueDrink9 May 23, 2025
08b911b
Fix tests for trailing and leading delimiter for multiple arguments
BlueDrink9 May 23, 2025
2e10b93
merge = and <- assignments
BlueDrink9 May 23, 2025
9a58ae3
tweak parameter queries
BlueDrink9 May 23, 2025
44425ea
Fix argument test
BlueDrink9 May 23, 2025
3feb748
Remove unnecessary predicate
BlueDrink9 May 23, 2025
6f7c455
Update packages/common/src/scopeSupportFacets/r.ts
BlueDrink9 May 23, 2025
96c316b
Remove blank lines
BlueDrink9 May 23, 2025
183c335
comment
BlueDrink9 May 23, 2025
bb1e8fb
update if state tests
BlueDrink9 May 23, 2025
20a1f3b
Add multiline and formal argument scope tests
BlueDrink9 May 24, 2025
7536803
update queries to pass tests
BlueDrink9 May 24, 2025
3bc6b72
Remove function name from argument iteration scope
BlueDrink9 May 25, 2025
481040e
Return formal demain to the entire function
BlueDrink9 May 25, 2025
8cbb250
prettier
BlueDrink9 May 25, 2025
9ce136d
add function name to formal argument iteration domain
BlueDrink9 May 25, 2025
a48eeab
add r doc
BlueDrink9 May 25, 2025
f761eef
Update packages/cursorless-org-docs/src/docs/user/languages/r.mdx
AndreasArvidsson May 25, 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
17 changes: 17 additions & 0 deletions data/fixtures/scopes/r/anonymousFunction.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
lapply(1:10, function(x) x^2)
---

[Content] =
[Domain] = 0:13-0:28
>---------------<
0| lapply(1:10, function(x) x^2)

[Removal] = 0:12-0:28
>----------------<
0| lapply(1:10, function(x) x^2)

[Leading delimiter] = 0:12-0:13
>-<
0| lapply(1:10, function(x) x^2)

[Insertion delimiter] = "\n"
17 changes: 17 additions & 0 deletions data/fixtures/scopes/r/argument.actual.iteration.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
foo(x, y)

---

[#1 Range] = 0:4-0:8
>----<
0| foo(x, y)

[#1 Domain] = 0:0-0:9
>---------<
0| foo(x, y)


[#2 Range] =
[#2 Domain] = 0:4-0:8
>----<
0| foo(x, y)
33 changes: 33 additions & 0 deletions data/fixtures/scopes/r/argument.actual.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
func(x, y)
---

[#1 Content] =
[#1 Domain] = 0:5-0:6
>-<
0| func(x, y)

[#1 Removal] = 0:5-0:8
>---<
0| func(x, y)

[#1 Trailing delimiter] = 0:6-0:8
>--<
0| func(x, y)

[#1 Insertion delimiter] = ", "


[#2 Content] =
[#2 Domain] = 0:8-0:9
>-<
0| func(x, y)

[#2 Removal] = 0:6-0:9
>---<
0| func(x, y)

[#2 Leading delimiter] = 0:6-0:8
>--<
0| func(x, y)

[#2 Insertion delimiter] = ", "
10 changes: 10 additions & 0 deletions data/fixtures/scopes/r/argument.actual2.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
func(1)
---

[Content] =
[Removal] =
[Domain] = 0:5-0:6
>-<
0| func(1)

[Insertion delimiter] = ", "
10 changes: 10 additions & 0 deletions data/fixtures/scopes/r/argument.actual3.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
func(...)
---

[Content] =
[Removal] =
[Domain] = 0:5-0:8
>---<
0| func(...)

[Insertion delimiter] = ", "
10 changes: 10 additions & 0 deletions data/fixtures/scopes/r/argument.actual4.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
func(x=1)
---

[Content] =
[Removal] =
[Domain] = 0:5-0:8
>---<
0| func(x=1)

[Insertion delimiter] = ", "
45 changes: 45 additions & 0 deletions data/fixtures/scopes/r/argument.actual5.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
foo(
x,
y
)

---

[#1 Content] =
[#1 Domain] = 1:7-1:8
>-<
1| x,

[#1 Removal] = 1:7-2:7
>--
1| x,
2| y
-------<

[#1 Trailing delimiter] = 1:8-2:7
>-
1| x,
2| y
-------<

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


[#2 Content] =
[#2 Domain] = 2:7-2:8
>-<
2| y

[#2 Removal] = 1:8-2:8
>-
1| x,
2| y
--------<

[#2 Leading delimiter] = 1:8-2:7
>-
1| x,
2| y
-------<

[#2 Insertion delimiter] = ",\n"
42 changes: 42 additions & 0 deletions data/fixtures/scopes/r/argument.formal.iteration.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
abc <- function(
x,
y
){
}

---

[#1 Range] = 0:16-3:0
>
0| abc <- function(
1| x,
2| y
3| ){
<

[#1 Domain] = 0:0-4:1
>----------------
0| abc <- function(
1| x,
2| y
3| ){
4| }
-<


[#2 Range] = 0:16-3:0
>
0| abc <- function(
1| x,
2| y
3| ){
<

[#2 Domain] = 0:7-4:1
>---------
0| abc <- function(
1| x,
2| y
3| ){
4| }
-<
33 changes: 33 additions & 0 deletions data/fixtures/scopes/r/argument.formal.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
abc <- function(x, y){ }
---

[#1 Content] =
[#1 Domain] = 0:16-0:17
>-<
0| abc <- function(x, y){ }

[#1 Removal] = 0:16-0:19
>---<
0| abc <- function(x, y){ }

[#1 Trailing delimiter] = 0:17-0:19
>--<
0| abc <- function(x, y){ }

[#1 Insertion delimiter] = ", "


[#2 Content] =
[#2 Domain] = 0:19-0:20
>-<
0| abc <- function(x, y){ }

[#2 Removal] = 0:17-0:20
>---<
0| abc <- function(x, y){ }

[#2 Leading delimiter] = 0:17-0:19
>--<
0| abc <- function(x, y){ }

[#2 Insertion delimiter] = ", "
25 changes: 25 additions & 0 deletions data/fixtures/scopes/r/argumentList.formal.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
abc <- function(x, y){ }
---

[#1 Content] =
[#1 Removal] = 0:16-0:20
>----<
0| abc <- function(x, y){ }

[#1 Domain] = 0:0-0:24
>------------------------<
0| abc <- function(x, y){ }

[#1 Insertion delimiter] = ", "


[#2 Content] =
[#2 Removal] = 0:16-0:20
>----<
0| abc <- function(x, y){ }

[#2 Domain] = 0:7-0:24
>-----------------<
0| abc <- function(x, y){ }

[#2 Insertion delimiter] = ", "
25 changes: 25 additions & 0 deletions data/fixtures/scopes/r/argumentList.formal2.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
abc <- function(){ }
---

[#1 Content] =
[#1 Removal] = 0:16-0:16
><
0| abc <- function(){ }

[#1 Domain] = 0:0-0:20
>--------------------<
0| abc <- function(){ }

[#1 Insertion delimiter] = ""


[#2 Content] =
[#2 Removal] = 0:16-0:16
><
0| abc <- function(){ }

[#2 Domain] = 0:7-0:20
>-------------<
0| abc <- function(){ }

[#2 Insertion delimiter] = ""
47 changes: 47 additions & 0 deletions data/fixtures/scopes/r/argumentList.formal3.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
abc <- function(
x,
y
){
}
---

[#1 Content] =
[#1 Removal] = 0:16-3:0
>
0| abc <- function(
1| x,
2| y
3| ){
<

[#1 Domain] = 0:0-4:1
>----------------
0| abc <- function(
1| x,
2| y
3| ){
4| }
-<

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


[#2 Content] =
[#2 Removal] = 0:16-3:0
>
0| abc <- function(
1| x,
2| y
3| ){
<

[#2 Domain] = 0:7-4:1
>---------
0| abc <- function(
1| x,
2| y
3| ){
4| }
-<

[#2 Insertion delimiter] = ",\n"
13 changes: 13 additions & 0 deletions data/fixtures/scopes/r/argumentList.formal4.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function(x, y){ }
---

[Content] =
[Removal] = 0:9-0:13
>----<
0| function(x, y){ }

[Domain] = 0:0-0:17
>-----------------<
0| function(x, y){ }

[Insertion delimiter] = ", "
10 changes: 10 additions & 0 deletions data/fixtures/scopes/r/comment.line.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Hello world
---

[Content] =
[Removal] =
[Domain] = 0:0-0:13
>-------------<
0| # Hello world

[Insertion delimiter] = "\n"
10 changes: 10 additions & 0 deletions data/fixtures/scopes/r/functionCall.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
lapply(1:10, function(x) x^2)
---

[Content] =
[Removal] =
[Domain] = 0:0-0:29
>-----------------------------<
0| lapply(1:10, function(x) x^2)

[Insertion delimiter] = " "
10 changes: 10 additions & 0 deletions data/fixtures/scopes/r/functionCallee.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
lapply(1:10, function(x) x^2)
---

[Content] =
[Removal] =
[Domain] = 0:0-0:6
>------<
0| lapply(1:10, function(x) x^2)

[Insertion delimiter] = " "
25 changes: 25 additions & 0 deletions data/fixtures/scopes/r/functionName.scope
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
abc <- function(arg){
TRUE
}
---

[Content] = 0:0-0:3
>---<
0| abc <- function(arg){

[Removal] = 0:0-0:7
>-------<
0| abc <- function(arg){

[Trailing delimiter] = 0:3-0:7
>----<
0| abc <- function(arg){

[Domain] = 0:0-2:1
>---------------------
0| abc <- function(arg){
1| TRUE
2| }
-<

[Insertion delimiter] = " "
Loading
Loading