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

Feature request: WSL mode #374

Open
kdy1 opened this issue Feb 2, 2018 · 1 comment
Open

Feature request: WSL mode #374

kdy1 opened this issue Feb 2, 2018 · 1 comment

Comments

@kdy1
Copy link

kdy1 commented Feb 2, 2018

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

this.runningTask = new Task(
this.configuration,
this.logger.createChildLogger('Task: '),
executable,
args,
cwd
);

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

const userWorkingDirectory = this._configuration.getCargoCwd();
if (userWorkingDirectory !== undefined && userWorkingDirectory !== workingDirectory) {
const manifestPath = join(workingDirectory, 'Cargo.toml');
args = ['--manifest-path', manifestPath].concat(args);
workingDirectory = userWorkingDirectory;
}
return { args, workingDirectory };

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>
@DamianRivas
Copy link

DamianRivas commented Jun 3, 2018

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 essentially cargo 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!

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

No branches or pull requests

2 participants