@@ -32,6 +32,10 @@ export class RustDependenciesProvider
32
32
return filePath . toLowerCase ( ) in this . dependenciesMap ;
33
33
}
34
34
35
+ isInitialized ( ) : boolean {
36
+ return Object . keys ( this . dependenciesMap ) . length !== 0 ;
37
+ }
38
+
35
39
refresh ( ) : void {
36
40
this . dependenciesMap = { } ;
37
41
this . _onDidChangeTreeData . fire ( ) ;
@@ -89,7 +93,12 @@ export class RustDependenciesProvider
89
93
}
90
94
91
95
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
+ ) ;
93
102
}
94
103
}
95
104
@@ -101,9 +110,9 @@ export class Dependency extends vscode.TreeItem {
101
110
public readonly collapsibleState : vscode . TreeItemCollapsibleState
102
111
) {
103
112
super ( label , collapsibleState ) ;
104
- this . id = this . dependencyPath . toLowerCase ( ) ;
105
- this . description = this . version ;
106
113
this . resourceUri = vscode . Uri . file ( dependencyPath ) ;
114
+ this . id = this . resourceUri . fsPath . toLowerCase ( ) ;
115
+ this . description = this . version ;
107
116
if ( this . version ) {
108
117
this . tooltip = `${ this . label } -${ this . version } ` ;
109
118
} else {
@@ -120,13 +129,13 @@ export class DependencyFile extends vscode.TreeItem {
120
129
public readonly collapsibleState : vscode . TreeItemCollapsibleState
121
130
) {
122
131
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 ( ) ;
125
134
if ( ! isDir ) {
126
135
this . command = {
127
136
command : "vscode.open" ,
128
137
title : "Open File" ,
129
- arguments : [ vscode . Uri . file ( this . dependencyPath ) ] ,
138
+ arguments : [ this . resourceUri ] ,
130
139
} ;
131
140
}
132
141
}
0 commit comments