fixing ts linting and rust test

This commit is contained in:
Bruno Ortiz 2023-04-26 22:02:38 -03:00
parent bd2160f014
commit 072f69e4c1
4 changed files with 30 additions and 28 deletions

View file

@ -1317,24 +1317,25 @@ fn sysroot_to_crate_graph(
.filter_map(|krate| { .filter_map(|krate| {
let file_id = load(&sysroot[krate].root)?; let file_id = load(&sysroot[krate].root)?;
let env = Env::default(); let env = Env::default();
let display_name = CrateDisplayName::from_canonical_name(sysroot[krate].name.clone()); let display_name =
let crate_id = crate_graph.add_crate_root( CrateDisplayName::from_canonical_name(sysroot[krate].name.clone());
let crate_id = crate_graph.add_crate_root(
file_id, file_id,
Edition::CURRENT, Edition::CURRENT,
Some(display_name), Some(display_name),
None, None,
cfg_options.clone(), cfg_options.clone(),
None, None,
env, env,
false, false,
CrateOrigin::Lang(LangCrateOrigin::from(&*sysroot[krate].name)), CrateOrigin::Lang(LangCrateOrigin::from(&*sysroot[krate].name)),
target_layout.clone(), target_layout.clone(),
channel, channel,
); );
Some((krate, crate_id)) Some((krate, crate_id))
}) })
.collect(), .collect(),
}; };
for from in sysroot.crates() { for from in sysroot.crates() {
for &to in sysroot[from].deps.iter() { for &to in sysroot[from].deps.iter() {

View file

@ -33,12 +33,12 @@ import { ExecOptions } from "child_process";
export type Workspace = export type Workspace =
| { kind: "Empty" } | { kind: "Empty" }
| { | {
kind: "Workspace Folder"; kind: "Workspace Folder";
} }
| { | {
kind: "Detached Files"; kind: "Detached Files";
files: vscode.TextDocument[]; files: vscode.TextDocument[];
}; };
export function fetchWorkspace(): Workspace { export function fetchWorkspace(): Workspace {
const folders = (vscode.workspace.workspaceFolders || []).filter( const folders = (vscode.workspace.workspaceFolders || []).filter(
@ -52,9 +52,9 @@ export function fetchWorkspace(): Workspace {
? rustDocuments.length === 0 ? rustDocuments.length === 0
? { kind: "Empty" } ? { kind: "Empty" }
: { : {
kind: "Detached Files", kind: "Detached Files",
files: rustDocuments, files: rustDocuments,
} }
: { kind: "Workspace Folder" }; : { kind: "Workspace Folder" };
} }
@ -476,4 +476,4 @@ export interface Disposable {
dispose(): void; dispose(): void;
} }
export type Cmd = (...args: any[]) => unknown; export type Cmd = (...args: any[]) => unknown;

View file

@ -1,12 +1,13 @@
import * as vscode from "vscode"; import * as vscode from "vscode";
import * as fspath from "path"; import * as fspath from "path";
import * as fs from "fs"; import * as fs from "fs";
import {CtxInit} from "./ctx"; import { CtxInit } from "./ctx";
import * as ra from "./lsp_ext"; import * as ra from "./lsp_ext";
import {FetchDependencyListResult} from "./lsp_ext"; import { FetchDependencyListResult } from "./lsp_ext";
export class RustDependenciesProvider export class RustDependenciesProvider
implements vscode.TreeDataProvider<Dependency | DependencyFile> { implements vscode.TreeDataProvider<Dependency | DependencyFile>
{
dependenciesMap: { [id: string]: Dependency | DependencyFile }; dependenciesMap: { [id: string]: Dependency | DependencyFile };
ctx: CtxInit; ctx: CtxInit;
@ -131,4 +132,4 @@ export class DependencyFile extends vscode.TreeItem {
} }
} }
export type DependencyId = { id: string }; export type DependencyId = { id: string };

View file

@ -211,4 +211,4 @@ async function isFileAtUri(uri: vscode.Uri): Promise<boolean> {
} catch { } catch {
return false; return false;
} }
} }