mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-10-31 12:04:43 +00:00 
			
		
		
		
	Rename dependency tree view and dependency provider
This commit is contained in:
		
							parent
							
								
									bfb81275fb
								
							
						
					
					
						commit
						c0eaff7dd1
					
				
					 2 changed files with 18 additions and 18 deletions
				
			
		|  | @ -288,13 +288,13 @@ export function openCargoToml(ctx: CtxInit): Cmd { | ||||||
| 
 | 
 | ||||||
| export function revealDependency(ctx: CtxInit): Cmd { | export function revealDependency(ctx: CtxInit): Cmd { | ||||||
|     return async (editor: RustEditor) => { |     return async (editor: RustEditor) => { | ||||||
|         if (!ctx.dependencies?.isInitialized()) { |         if (!ctx.dependenciesProvider?.isInitialized()) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         const documentPath = editor.document.uri.fsPath; |         const documentPath = editor.document.uri.fsPath; | ||||||
|         const dep = ctx.dependencies?.getDependency(documentPath); |         const dep = ctx.dependenciesProvider?.getDependency(documentPath); | ||||||
|         if (dep) { |         if (dep) { | ||||||
|             await ctx.treeView?.reveal(dep, { select: true, expand: true }); |             await ctx.dependencyTreeView?.reveal(dep, { select: true, expand: true }); | ||||||
|         } else { |         } else { | ||||||
|             await revealParentChain(editor.document, ctx); |             await revealParentChain(editor.document, ctx); | ||||||
|         } |         } | ||||||
|  | @ -340,10 +340,10 @@ async function revealParentChain(document: RustDocument, ctx: CtxInit) { | ||||||
|             // a open file referencing the old version
 |             // a open file referencing the old version
 | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|     } while (!ctx.dependencies?.contains(documentPath)); |     } while (!ctx.dependenciesProvider?.contains(documentPath)); | ||||||
|     parentChain.reverse(); |     parentChain.reverse(); | ||||||
|     for (const idx in parentChain) { |     for (const idx in parentChain) { | ||||||
|         const treeView = ctx.treeView; |         const treeView = ctx.dependencyTreeView; | ||||||
|         if (!treeView) { |         if (!treeView) { | ||||||
|             continue; |             continue; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -84,8 +84,8 @@ export class Ctx implements RustAnalyzerExtensionApi { | ||||||
|     private commandFactories: Record<string, CommandFactory>; |     private commandFactories: Record<string, CommandFactory>; | ||||||
|     private commandDisposables: Disposable[]; |     private commandDisposables: Disposable[]; | ||||||
|     private unlinkedFiles: vscode.Uri[]; |     private unlinkedFiles: vscode.Uri[]; | ||||||
|     private _dependencies: RustDependenciesProvider | undefined; |     private _dependenciesProvider: RustDependenciesProvider | undefined; | ||||||
|     private _treeView: vscode.TreeView<Dependency | DependencyFile | DependencyId> | undefined; |     private _dependencyTreeView: vscode.TreeView<Dependency | DependencyFile | DependencyId> | undefined; | ||||||
|     private lastStatus: ServerStatusParams | { health: "stopped" } = { health: "stopped" }; |     private lastStatus: ServerStatusParams | { health: "stopped" } = { health: "stopped" }; | ||||||
|     private _serverVersion: string; |     private _serverVersion: string; | ||||||
|     private statusBarActiveEditorListener: Disposable; |     private statusBarActiveEditorListener: Disposable; | ||||||
|  | @ -102,12 +102,12 @@ export class Ctx implements RustAnalyzerExtensionApi { | ||||||
|         return this._client; |         return this._client; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     get treeView() { |     get dependencyTreeView() { | ||||||
|         return this._treeView; |         return this._dependencyTreeView; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     get dependencies() { |     get dependenciesProvider() { | ||||||
|         return this._dependencies; |         return this._dependenciesProvider; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     constructor( |     constructor( | ||||||
|  | @ -285,13 +285,13 @@ export class Ctx implements RustAnalyzerExtensionApi { | ||||||
|             ...this, |             ...this, | ||||||
|             client: client, |             client: client, | ||||||
|         }; |         }; | ||||||
|         this._dependencies = new RustDependenciesProvider(ctxInit); |         this._dependenciesProvider = new RustDependenciesProvider(ctxInit); | ||||||
|         this._treeView = vscode.window.createTreeView("rustDependencies", { |         this._dependencyTreeView = vscode.window.createTreeView("rustDependencies", { | ||||||
|             treeDataProvider: this._dependencies, |             treeDataProvider: this._dependenciesProvider, | ||||||
|             showCollapseAll: true, |             showCollapseAll: true, | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         this.pushExtCleanup(this._treeView); |         this.pushExtCleanup(this._dependencyTreeView); | ||||||
|         vscode.window.onDidChangeActiveTextEditor(async (e) => { |         vscode.window.onDidChangeActiveTextEditor(async (e) => { | ||||||
|             // we should skip documents that belong to the current workspace
 |             // we should skip documents that belong to the current workspace
 | ||||||
|             if (this.shouldRevealDependency(e)) { |             if (this.shouldRevealDependency(e)) { | ||||||
|  | @ -303,7 +303,7 @@ export class Ctx implements RustAnalyzerExtensionApi { | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         this.treeView?.onDidChangeVisibility(async (e) => { |         this.dependencyTreeView?.onDidChangeVisibility(async (e) => { | ||||||
|             if (e.visible) { |             if (e.visible) { | ||||||
|                 const activeEditor = vscode.window.activeTextEditor; |                 const activeEditor = vscode.window.activeTextEditor; | ||||||
|                 if (this.shouldRevealDependency(activeEditor)) { |                 if (this.shouldRevealDependency(activeEditor)) { | ||||||
|  | @ -322,7 +322,7 @@ export class Ctx implements RustAnalyzerExtensionApi { | ||||||
|             e !== undefined && |             e !== undefined && | ||||||
|             isRustEditor(e) && |             isRustEditor(e) && | ||||||
|             !isDocumentInWorkspace(e.document) && |             !isDocumentInWorkspace(e.document) && | ||||||
|             (this.treeView?.visible || false) |             (this.dependencyTreeView?.visible || false) | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -423,7 +423,7 @@ export class Ctx implements RustAnalyzerExtensionApi { | ||||||
|                 } else { |                 } else { | ||||||
|                     statusBar.command = "rust-analyzer.openLogs"; |                     statusBar.command = "rust-analyzer.openLogs"; | ||||||
|                 } |                 } | ||||||
|                 this.dependencies?.refresh(); |                 this.dependenciesProvider?.refresh(); | ||||||
|                 break; |                 break; | ||||||
|             case "warning": |             case "warning": | ||||||
|                 statusBar.color = new vscode.ThemeColor("statusBarItem.warningForeground"); |                 statusBar.color = new vscode.ThemeColor("statusBarItem.warningForeground"); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Giga Bowser
						Giga Bowser