running prettier

This commit is contained in:
Bruno Ortiz 2023-04-02 22:37:07 -03:00
parent 440889edec
commit 061940dad9
4 changed files with 86 additions and 91 deletions

View file

@ -116,7 +116,7 @@ export class Ctx {
constructor( constructor(
readonly extCtx: vscode.ExtensionContext, readonly extCtx: vscode.ExtensionContext,
commandFactories: Record<string, CommandFactory>, commandFactories: Record<string, CommandFactory>,
workspace: Workspace, workspace: Workspace
) { ) {
extCtx.subscriptions.push(this); extCtx.subscriptions.push(this);
this.statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left); this.statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
@ -128,8 +128,7 @@ export class Ctx {
this.state = new PersistentState(extCtx.globalState); this.state = new PersistentState(extCtx.globalState);
this.config = new Config(extCtx); this.config = new Config(extCtx);
this.updateCommands("disable" this.updateCommands("disable");
);
this.setServerStatus({ this.setServerStatus({
health: "stopped", health: "stopped",
}); });
@ -276,7 +275,7 @@ export class Ctx {
private prepareTreeDependenciesView(client: lc.LanguageClient) { private prepareTreeDependenciesView(client: lc.LanguageClient) {
const ctxInit: CtxInit = { const ctxInit: CtxInit = {
...this, ...this,
client: client client: client,
}; };
const rootPath = vscode.workspace.workspaceFolders![0].uri.fsPath; const rootPath = vscode.workspace.workspaceFolders![0].uri.fsPath;
this._dependencies = new RustDependenciesProvider(rootPath, ctxInit); this._dependencies = new RustDependenciesProvider(rootPath, ctxInit);

View file

@ -13,8 +13,8 @@ import * as ra 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;
constructor(private readonly workspaceRoot: string,ctx: CtxInit) { constructor(private readonly workspaceRoot: string,ctx: CtxInit) {
this.dependenciesMap = {}; this.dependenciesMap = {};
@ -82,7 +82,10 @@ export class RustDependenciesProvider
private async getRootDependencies(): Promise<Dependency[]> { private async getRootDependencies(): Promise<Dependency[]> {
const crates = await this.ctx.client.sendRequest(ra.fetchDependencyGraph, {}); const crates = await this.ctx.client.sendRequest(ra.fetchDependencyGraph, {});
const dependenciesResult: FetchDependencyGraphResult = await this.ctx.client.sendRequest(ra.fetchDependencyGraph, {}); const dependenciesResult: FetchDependencyGraphResult = await this.ctx.client.sendRequest(
ra.fetchDependencyGraph,
{}
);
const crates = dependenciesResult.crates; const crates = dependenciesResult.crates;
const deps = crates.map((crate) => { const deps = crates.map((crate) => {
const dep = this.toDep(crate.name, crate.version, crate.path); const dep = this.toDep(crate.name, crate.version, crate.path);
@ -95,12 +98,7 @@ export class RustDependenciesProvider
private toDep(moduleName: string, version: string, path: string): Dependency { private toDep(moduleName: string, version: string, path: string): Dependency {
// const cratePath = fspath.join(basePath, `${moduleName}-${version}`); // const cratePath = fspath.join(basePath, `${moduleName}-${version}`);
return new Dependency( return new Dependency(moduleName, version, path, vscode.TreeItemCollapsibleState.Collapsed);
moduleName,
version,
path,
vscode.TreeItemCollapsibleState.Collapsed
);
} }
} }

View file

@ -28,8 +28,7 @@ export async function activate(
"both plugins to not work correctly. You should disable one of them.", "both plugins to not work correctly. You should disable one of them.",
"Got it" "Got it"
) )
.then(() => { .then(() => {}, console.error);
}, console.error);
} }
const ctx = new Ctx(context, createCommands(), fetchWorkspace()); const ctx = new Ctx(context, createCommands(), fetchWorkspace());
@ -145,8 +144,7 @@ function createCommands(): Record<string, CommandFactory> {
health: "stopped", health: "stopped",
}); });
}, },
disabled: (_) => async () => { disabled: (_) => async () => {},
},
}, },
analyzerStatus: { enabled: commands.analyzerStatus }, analyzerStatus: { enabled: commands.analyzerStatus },
@ -192,6 +190,6 @@ function createCommands(): Record<string, CommandFactory> {
showReferences: { enabled: commands.showReferences }, showReferences: { enabled: commands.showReferences },
triggerParameterHints: { enabled: commands.triggerParameterHints }, triggerParameterHints: { enabled: commands.triggerParameterHints },
openLogs: { enabled: commands.openLogs }, openLogs: { enabled: commands.openLogs },
revealDependency: {enabled: commands.revealDependency} revealDependency: { enabled: commands.revealDependency },
}; };
} }