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

Update tree-sitter-r.wasm and make queries work #2726

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file modified extensions/positron-r/resources/testing/tree-sitter-r.wasm
100644 → 100755
Binary file not shown.
34 changes: 14 additions & 20 deletions extensions/positron-r/src/testing/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,43 +93,37 @@ async function findTests(uri: vscode.Uri) {
(call
function: [
(identifier) @_function.name
(namespace_get
function: (identifier) @_function.name
Comment on lines -96 to -97
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a slight loss of functionality, in the sense that I'm not looking for testthat::test_that() at the moment. But I'll bring that back soon (and I also don't think that is very common).

)
] (#eq? @_function.name "test_that")
arguments:
(arguments
value: (string) @label
value: (_)
arguments: (arguments
(argument
value: (string) @label
Comment on lines -100 to +99
Copy link
Member Author

Choose a reason for hiding this comment

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

I've also simplified the query here, because I'd really rather make larger assertions about the structure of the overall call by using match.call(), which is much easier to do now than it was when I first worked on the test explorer. See #2633.

)
)
) @call

(call
function: [
(identifier) @_superfunction.name
(namespace_get
function: (identifier) @_superfunction.name
)
Comment on lines -110 to -112
Copy link
Member Author

Choose a reason for hiding this comment

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

Ditto above. Not currently capturing testthat::describe() but it will come back soon.

] (#eq? @_superfunction.name "describe")
arguments:
(arguments
arguments: (arguments
(argument
value: (string) @superlabel
value: (_
(call
Comment on lines -117 to -118
Copy link
Member Author

Choose a reason for hiding this comment

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

See above re: plans to vet the entire capture with match.call().

)
(argument
value: (braced_expression
body: (call
function: [
(identifier) @_function.name
(namespace_get
function: (identifier) @_function.name
)
Comment on lines -121 to -123
Copy link
Member Author

Choose a reason for hiding this comment

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

Ditto above re: testthat::it(). Again, I doubt this is of any practical significance.

] (#eq? @_function.name "it")
arguments:
(arguments
arguments: (arguments
(argument
value: (string) @label
value: (_)
Copy link
Member Author

Choose a reason for hiding this comment

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

See above re: plans to vet the entire capture with match.call().

)
)
) @call
)
)
)
) @supercall
`
);
Expand Down
Loading