Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Pass file directory as cwd for Run test of CodeLens #1584

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Gowee
Copy link

@Gowee Gowee commented Nov 2, 2019

In the previous implementation:

When there is a Cargo Workspace including several member packages, clicking CodeLens Run test button in source code files of a member package triggers shell execution cargo test -- --no-capture ... without specifying a current working directory.It appears that the default cwd is the Workspace / top-level package root (as expected).

Consequently, no targeted tests are actually perfomed as cargo test does not cover member packages unless --workspace is specified.


To fix the problem, there are two feasible ways:

  1. Adding --workspace option to cargo test.
  2. Setting the cwd properly.

The first way is much slower than the second as it takes more time to filter out unnecessary tests outside current member packages.

So this commit passes the file directory as Cmd.cwd in CodeLens Command to rls-vscode so that cargo test ... can be executed with proper cwd.

@bors
Copy link
Contributor

bors commented Jun 20, 2022

☔ The latest upstream changes (presumably #1740) made this pull request unmergeable. Please resolve the merge conflicts.

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

Successfully merging this pull request may close these issues.

2 participants