Skip to content

Commit d8eb839

Browse files
committed
Rename dependency tree view and dependency provider
1 parent 5afee0d commit d8eb839

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/tools/rust-analyzer/editors/code/src/commands.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,13 @@ export function openCargoToml(ctx: CtxInit): Cmd {
288288

289289
export function revealDependency(ctx: CtxInit): Cmd {
290290
return async (editor: RustEditor) => {
291-
if (!ctx.dependencies?.isInitialized()) {
291+
if (!ctx.dependenciesProvider?.isInitialized()) {
292292
return;
293293
}
294294
const documentPath = editor.document.uri.fsPath;
295-
const dep = ctx.dependencies?.getDependency(documentPath);
295+
const dep = ctx.dependenciesProvider?.getDependency(documentPath);
296296
if (dep) {
297-
await ctx.treeView?.reveal(dep, { select: true, expand: true });
297+
await ctx.dependencyTreeView?.reveal(dep, { select: true, expand: true });
298298
} else {
299299
await revealParentChain(editor.document, ctx);
300300
}
@@ -340,10 +340,10 @@ async function revealParentChain(document: RustDocument, ctx: CtxInit) {
340340
// a open file referencing the old version
341341
return;
342342
}
343-
} while (!ctx.dependencies?.contains(documentPath));
343+
} while (!ctx.dependenciesProvider?.contains(documentPath));
344344
parentChain.reverse();
345345
for (const idx in parentChain) {
346-
const treeView = ctx.treeView;
346+
const treeView = ctx.dependencyTreeView;
347347
if (!treeView) {
348348
continue;
349349
}

src/tools/rust-analyzer/editors/code/src/ctx.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ export class Ctx implements RustAnalyzerExtensionApi {
8484
private commandFactories: Record<string, CommandFactory>;
8585
private commandDisposables: Disposable[];
8686
private unlinkedFiles: vscode.Uri[];
87-
private _dependencies: RustDependenciesProvider | undefined;
88-
private _treeView: vscode.TreeView<Dependency | DependencyFile | DependencyId> | undefined;
87+
private _dependenciesProvider: RustDependenciesProvider | undefined;
88+
private _dependencyTreeView: vscode.TreeView<Dependency | DependencyFile | DependencyId> | undefined;
8989
private lastStatus: ServerStatusParams | { health: "stopped" } = { health: "stopped" };
9090
private _serverVersion: string;
9191
private statusBarActiveEditorListener: Disposable;
@@ -102,12 +102,12 @@ export class Ctx implements RustAnalyzerExtensionApi {
102102
return this._client;
103103
}
104104

105-
get treeView() {
106-
return this._treeView;
105+
get dependencyTreeView() {
106+
return this._dependencyTreeView;
107107
}
108108

109-
get dependencies() {
110-
return this._dependencies;
109+
get dependenciesProvider() {
110+
return this._dependenciesProvider;
111111
}
112112

113113
constructor(
@@ -285,13 +285,13 @@ export class Ctx implements RustAnalyzerExtensionApi {
285285
...this,
286286
client: client,
287287
};
288-
this._dependencies = new RustDependenciesProvider(ctxInit);
289-
this._treeView = vscode.window.createTreeView("rustDependencies", {
290-
treeDataProvider: this._dependencies,
288+
this._dependenciesProvider = new RustDependenciesProvider(ctxInit);
289+
this._dependencyTreeView = vscode.window.createTreeView("rustDependencies", {
290+
treeDataProvider: this._dependenciesProvider,
291291
showCollapseAll: true,
292292
});
293293

294-
this.pushExtCleanup(this._treeView);
294+
this.pushExtCleanup(this._dependencyTreeView);
295295
vscode.window.onDidChangeActiveTextEditor(async (e) => {
296296
// we should skip documents that belong to the current workspace
297297
if (this.shouldRevealDependency(e)) {
@@ -303,7 +303,7 @@ export class Ctx implements RustAnalyzerExtensionApi {
303303
}
304304
});
305305

306-
this.treeView?.onDidChangeVisibility(async (e) => {
306+
this.dependencyTreeView?.onDidChangeVisibility(async (e) => {
307307
if (e.visible) {
308308
const activeEditor = vscode.window.activeTextEditor;
309309
if (this.shouldRevealDependency(activeEditor)) {
@@ -322,7 +322,7 @@ export class Ctx implements RustAnalyzerExtensionApi {
322322
e !== undefined &&
323323
isRustEditor(e) &&
324324
!isDocumentInWorkspace(e.document) &&
325-
(this.treeView?.visible || false)
325+
(this.dependencyTreeView?.visible || false)
326326
);
327327
}
328328

@@ -423,7 +423,7 @@ export class Ctx implements RustAnalyzerExtensionApi {
423423
} else {
424424
statusBar.command = "rust-analyzer.openLogs";
425425
}
426-
this.dependencies?.refresh();
426+
this.dependenciesProvider?.refresh();
427427
break;
428428
case "warning":
429429
statusBar.color = new vscode.ThemeColor("statusBarItem.warningForeground");

0 commit comments

Comments
 (0)