Skip to content

Support VS Code testing API #9798

Closed
Closed
@matklad

Description

@matklad

https://code.visualstudio.com/api/extension-guides/testing

We might want to support that.

The way I understand it, what VS Code wants is a global view of a hierarchy of all the tests in a project. There are two potential sources for such view:

  • statically discovered tests (eg, re-run cargo test -- --list on every change, or use symbol index to list every #[test] function)
  • external sources -- display a result of a test run

I don't think we can support the first case correctly: in the limit, it is a global view of all the tests, and to maintain that we'd have to do O(N) work on every change worst-case. Displaying a hierarchy of tests also feels like it duplicates other navigation functionality.

So I think we should do the following:

  • on the server side, provide the API to fetch project model, such that the vscode can draw one node per cargo package/target
  • on the client side, change our test runners to optionally pass in the --message-format json flag, and to populate nodes bellow cargo target with test results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-vscodevscode plugin issuesS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions