@@ -32,6 +32,10 @@ export class RustDependenciesProvider
3232 return filePath . toLowerCase ( ) in this . dependenciesMap ;
3333 }
3434
35+ isInitialized ( ) : boolean {
36+ return Object . keys ( this . dependenciesMap ) . length !== 0 ;
37+ }
38+
3539 refresh ( ) : void {
3640 this . dependenciesMap = { } ;
3741 this . _onDidChangeTreeData . fire ( ) ;
@@ -89,7 +93,12 @@ export class RustDependenciesProvider
8993 }
9094
9195 private toDep ( moduleName : string , version : string , path : string ) : Dependency {
92- return new Dependency ( moduleName , version , path , vscode . TreeItemCollapsibleState . Collapsed ) ;
96+ return new Dependency (
97+ moduleName ,
98+ version ,
99+ vscode . Uri . parse ( path ) . fsPath ,
100+ vscode . TreeItemCollapsibleState . Collapsed
101+ ) ;
93102 }
94103}
95104
@@ -101,9 +110,9 @@ export class Dependency extends vscode.TreeItem {
101110 public readonly collapsibleState : vscode . TreeItemCollapsibleState
102111 ) {
103112 super ( label , collapsibleState ) ;
104- this . id = this . dependencyPath . toLowerCase ( ) ;
105- this . description = this . version ;
106113 this . resourceUri = vscode . Uri . file ( dependencyPath ) ;
114+ this . id = this . resourceUri . fsPath . toLowerCase ( ) ;
115+ this . description = this . version ;
107116 if ( this . version ) {
108117 this . tooltip = `${ this . label } -${ this . version } ` ;
109118 } else {
@@ -120,13 +129,13 @@ export class DependencyFile extends vscode.TreeItem {
120129 public readonly collapsibleState : vscode . TreeItemCollapsibleState
121130 ) {
122131 super ( vscode . Uri . file ( dependencyPath ) , collapsibleState ) ;
123- this . id = this . dependencyPath . toLowerCase ( ) ;
124- const isDir = fs . lstatSync ( this . dependencyPath ) . isDirectory ( ) ;
132+ this . id = this . resourceUri ! . fsPath . toLowerCase ( ) ;
133+ const isDir = fs . lstatSync ( this . resourceUri ! . fsPath ) . isDirectory ( ) ;
125134 if ( ! isDir ) {
126135 this . command = {
127136 command : "vscode.open" ,
128137 title : "Open File" ,
129- arguments : [ vscode . Uri . file ( this . dependencyPath ) ] ,
138+ arguments : [ this . resourceUri ] ,
130139 } ;
131140 }
132141 }
0 commit comments