mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
running prettier
This commit is contained in:
parent
440889edec
commit
061940dad9
4 changed files with 86 additions and 91 deletions
|
@ -116,7 +116,7 @@ export class Ctx {
|
|||
constructor(
|
||||
readonly extCtx: vscode.ExtensionContext,
|
||||
commandFactories: Record<string, CommandFactory>,
|
||||
workspace: Workspace,
|
||||
workspace: Workspace
|
||||
) {
|
||||
extCtx.subscriptions.push(this);
|
||||
this.statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
|
||||
|
@ -128,8 +128,7 @@ export class Ctx {
|
|||
this.state = new PersistentState(extCtx.globalState);
|
||||
this.config = new Config(extCtx);
|
||||
|
||||
this.updateCommands("disable"
|
||||
);
|
||||
this.updateCommands("disable");
|
||||
this.setServerStatus({
|
||||
health: "stopped",
|
||||
});
|
||||
|
@ -276,7 +275,7 @@ export class Ctx {
|
|||
private prepareTreeDependenciesView(client: lc.LanguageClient) {
|
||||
const ctxInit: CtxInit = {
|
||||
...this,
|
||||
client: client
|
||||
client: client,
|
||||
};
|
||||
const rootPath = vscode.workspace.workspaceFolders![0].uri.fsPath;
|
||||
this._dependencies = new RustDependenciesProvider(rootPath, ctxInit);
|
||||
|
|
|
@ -13,8 +13,8 @@ import * as ra from "./lsp_ext";
|
|||
export class RustDependenciesProvider
|
||||
implements vscode.TreeDataProvider<Dependency | DependencyFile>
|
||||
{
|
||||
|
||||
dependenciesMap: { [id: string]: Dependency | DependencyFile };ctx: CtxInit;
|
||||
dependenciesMap: { [id: string]: Dependency | DependencyFile };
|
||||
ctx: CtxInit;
|
||||
|
||||
constructor(private readonly workspaceRoot: string,ctx: CtxInit) {
|
||||
this.dependenciesMap = {};
|
||||
|
@ -82,7 +82,10 @@ export class RustDependenciesProvider
|
|||
private async getRootDependencies(): Promise<Dependency[]> {
|
||||
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 deps = crates.map((crate) => {
|
||||
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 {
|
||||
// const cratePath = fspath.join(basePath, `${moduleName}-${version}`);
|
||||
return new Dependency(
|
||||
moduleName,
|
||||
version,
|
||||
path,
|
||||
vscode.TreeItemCollapsibleState.Collapsed
|
||||
);
|
||||
return new Dependency(moduleName, version, path, vscode.TreeItemCollapsibleState.Collapsed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,7 @@ export async function activate(
|
|||
"both plugins to not work correctly. You should disable one of them.",
|
||||
"Got it"
|
||||
)
|
||||
.then(() => {
|
||||
}, console.error);
|
||||
.then(() => {}, console.error);
|
||||
}
|
||||
|
||||
const ctx = new Ctx(context, createCommands(), fetchWorkspace());
|
||||
|
@ -145,8 +144,7 @@ function createCommands(): Record<string, CommandFactory> {
|
|||
health: "stopped",
|
||||
});
|
||||
},
|
||||
disabled: (_) => async () => {
|
||||
},
|
||||
disabled: (_) => async () => {},
|
||||
},
|
||||
|
||||
analyzerStatus: { enabled: commands.analyzerStatus },
|
||||
|
@ -192,6 +190,6 @@ function createCommands(): Record<string, CommandFactory> {
|
|||
showReferences: { enabled: commands.showReferences },
|
||||
triggerParameterHints: { enabled: commands.triggerParameterHints },
|
||||
openLogs: { enabled: commands.openLogs },
|
||||
revealDependency: {enabled: commands.revealDependency}
|
||||
revealDependency: { enabled: commands.revealDependency },
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue