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

R: make outline and breadcrumbs work for tests and test files #1428

Open
jennybc opened this issue Sep 27, 2023 · 5 comments
Open

R: make outline and breadcrumbs work for tests and test files #1428

jennybc opened this issue Sep 27, 2023 · 5 comments
Assignees
Labels

Comments

@jennybc
Copy link
Member

jennybc commented Sep 27, 2023

Our current outline doesn't know how to help with test files.

I'm seeing "No symbols found in document 'test-multi-file.R'".

Screenshot 2023-09-27 at 9 12 33 AM
@jennybc
Copy link
Member Author

jennybc commented Oct 4, 2023

@juliasilge I nominate this one for inclusion in the package dev epic issue. What do you think?

@juliasilge
Copy link
Contributor

Yes, makes sense @jennybc!

@juliasilge
Copy link
Contributor

The outline is generated from "document symbols", which in this case come from ark. We'll need to add testthat statements as document symbols to get them to show up in the outline. From my experimenting so far, as of right now, something has to be assigned to be a document symbol that gets added to the outline, like:

## this does get added to the outline
x <- 1

## or
y = 2

## or
z <- function(i) {
    i + 1
}

## this does not get added to the outline
for (i in 1:3) {
    print(i) 
}

Alternatively, we could add an additional document symbol provider in the R extension (not ark) and write out rules for testthat document symbols in Typescript. The docs for registerDocumentSymbolProvider() say:

Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

So if for some reason it's not appropriate to add this to ark, we could do this.

@juliasilge
Copy link
Contributor

I chatted with some other R folks today, and we want to focus on UI for testing in #1365 and not prioritize getting test files to show up with good content in the outline for now. We'll leave this open but I am taking it out of the R package development epic.

@jennybc jennybc added this to the Release Candidate milestone Feb 23, 2024
@wesm wesm added the lang: r label Feb 29, 2024
@jennybc jennybc changed the title R: make outline work for tests and test files R: make outline and breadcrumbs work for tests and test files Apr 19, 2024
@jennybc
Copy link
Member Author

jennybc commented Apr 19, 2024

I'm adding some recent feedback from @hadley here, because it's super related. But when someone actually works on this, it's possible these become two separate issues.

In regular R files, I can click in the breadcrumbs to see all the functions

Screenshot 2024-04-19 at 08 11 55

it’d be nice if I could see all the test sections and names in a test file

Screenshot 2024-04-19 at 08 12 24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants