fixing stblib loading

This commit is contained in:
bruno-ortiz 2022-02-25 21:53:47 -03:00 committed by Bruno Ortiz
parent 795a1cbe89
commit 68aa20bb8a

View file

@ -80,6 +80,7 @@ export class RustDependenciesProvider implements vscode.TreeDataProvider<Depende
const basePath = fspath.join(registryDir, fs.readdirSync(registryDir)[0]); const basePath = fspath.join(registryDir, fs.readdirSync(registryDir)[0]);
const deps = await this.getDepsInCartoTree(basePath); const deps = await this.getDepsInCartoTree(basePath);
const stdlib = await this.getStdLib(); const stdlib = await this.getStdLib();
this.dependenciesMap[stdlib.dependencyPath.toLowerCase()] = stdlib;
return [stdlib].concat(deps); return [stdlib].concat(deps);
} }
@ -87,12 +88,14 @@ export class RustDependenciesProvider implements vscode.TreeDataProvider<Depende
const toolchain = await activeToolchain(); const toolchain = await activeToolchain();
const rustVersion = await getRustcVersion(os.homedir()); const rustVersion = await getRustcVersion(os.homedir());
const stdlibPath = fspath.join(os.homedir(), '.rustup', 'toolchains', toolchain, 'lib', 'rustlib', 'src', 'rust', 'library'); const stdlibPath = fspath.join(os.homedir(), '.rustup', 'toolchains', toolchain, 'lib', 'rustlib', 'src', 'rust', 'library');
return new Dependency( const stdlib = new Dependency(
"stdlib", "stdlib",
rustVersion, rustVersion,
stdlibPath, stdlibPath,
vscode.TreeItemCollapsibleState.Collapsed vscode.TreeItemCollapsibleState.Collapsed
); );
return stdlib;
} }
private async getDepsInCartoTree(basePath: string): Promise<Dependency[]> { private async getDepsInCartoTree(basePath: string): Promise<Dependency[]> {