Skip to content
This repository was archived by the owner on Nov 18, 2022. It is now read-only.

Support rust-analyzer as alternate LSP engine #793

Merged
merged 20 commits into from
May 12, 2020
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Simplify getting sysroot
  • Loading branch information
Xanewok committed May 7, 2020
commit 9b3dec31eaabb163731fd4d211a82787640cdbee
17 changes: 5 additions & 12 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,19 +347,12 @@ export class ClientWorkspace {
}

private async getSysroot(env: typeof process.env): Promise<string> {
const rustcPrintSysroot = () =>
this.config.rustupDisabled
? exec('rustc --print sysroot', { env })
: exec(
`${this.config.rustupPath} run ${this.config.channel} rustc --print sysroot`,
{ env },
);
const printSysrootCmd = this.config.rustupDisabled
? 'rustc --print sysroot'
: `${this.config.rustupPath} run ${this.config.channel} rustc --print sysroot`;

const { stdout } = await rustcPrintSysroot();
return stdout
.toString()
.replace('\n', '')
.replace('\r', '');
const { stdout } = await exec(printSysrootCmd, { env });
return stdout.toString().trim();
}

// Make an evironment to run the RLS.
Expand Down