vscode-rust
vscode-rust copied to clipboard
Feature request: WSL mode
Version of VSCode: 1.19.3 Version of the extension: current master OS: Windows 10
Description:
I want to install rust in wsl. I changed
https://github.com/editor-rs/vscode-rust/blob/f78d23430af4a6429f7b686e6c5f7c3895e2052a/src/components/cargo/output_channel_task_manager.ts#L59-L65
to
this.runningTask = new Task(
this.configuration,
this.logger.createChildLogger('Task: '),
'wsl',
[executable, ...args],
cwd
);
set working directory to project root (at config)
and changed
https://github.com/editor-rs/vscode-rust/blob/f78d23430af4a6429f7b686e6c5f7c3895e2052a/src/components/cargo/CargoTaskManager.ts#L302-L308
to
const userWorkingDirectory = this._configuration.getCargoCwd();
if (userWorkingDirectory !== undefined && userWorkingDirectory !== workingDirectory) {
const manifestPath = correctPath(join(workingDirectory, 'Cargo.toml'));
args = ['--manifest-path', manifestPath].concat(args);
workingDirectory = userWorkingDirectory;
}
return { args, workingDirectory };
cargo check/build/test works well. But it's too hacky and it should be configurable.
Output of the "Rust logging" channel:
<not relevant>
I would also like to see support for Windows Subsystem for Linux in Windows 10. Here is the filepath that it's installed to when I follow the guidelines in the Rust website.
✗ whereis rustc
rustc: /home/damianrivas/.cargo/bin/rustc
✗ whereis cargo
cargo: /home/damianrivas/.cargo/bin/cargo
If you rely on the command line in any way, it's possible to run processes in WSL from the Windows environment like this (as an example):
CMD:
wsl.exe /home/damianrivas/.cargo/bin/cargo run
Explanation:
-
wsl.exe
: Recommended method to invoke WSL -
/home/damianrivas/.cargo/bin/cargo run
: This is essentiallycargo run
You can also convert between WSL and Windows versions of filepaths
$(wslpath 'C:\Users\Damian\rust\hello\hello.rs')
The above should return /mnt/c/users/Damian/rust/hello/hello.rs
-
wlspath
: A built-in interoperability WSL tool to convert between Unix and Windows paths. -
C:\Users\Damian\rust\hello\hello.rs
: the Windows path where the file we want is located.
I hope this helps!