Skip to content

Commit 0ec0c40

Browse files
committed
add location for PackageNode and fix View repository
1 parent cfcdc65 commit 0ec0c40

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

src/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ async function executeTaskWithUI(
421421
*/
422422
function openInExternalEditor(packageNode: PackageNode) {
423423
try {
424-
const uri = vscode.Uri.parse(packageNode.path, true);
424+
const uri = vscode.Uri.parse(packageNode.location, true);
425425
vscode.env.openExternal(uri);
426426
} catch {
427427
// ignore error

src/ui/PackageDependencyProvider.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export class PackageNode {
4141
constructor(
4242
public name: string,
4343
public path: string,
44+
public location: string,
4445
public version: string,
4546
public type: "local" | "remote" | "editing"
4647
) {}
@@ -163,7 +164,14 @@ export class PackageDependenciesProvider implements vscode.TreeDataProvider<Tree
163164
const type = this.dependencyType(dependency);
164165
const version = this.dependencyDisplayVersion(dependency);
165166
const packagePath = this.dependencyPackagePath(dependency, folderContext);
166-
return new PackageNode(dependency.packageRef.identity, packagePath, version, type);
167+
const location = dependency.packageRef.location;
168+
return new PackageNode(
169+
dependency.packageRef.identity,
170+
packagePath,
171+
location,
172+
version,
173+
type
174+
);
167175
}) ?? []
168176
);
169177
}
@@ -189,6 +197,7 @@ export class PackageDependenciesProvider implements vscode.TreeDataProvider<Tree
189197
new PackageNode(
190198
dependency.packageRef.identity,
191199
dependency.packageRef.location,
200+
dependency.packageRef.location,
192201
"local",
193202
"local"
194203
)
@@ -206,6 +215,7 @@ export class PackageDependenciesProvider implements vscode.TreeDataProvider<Tree
206215
new PackageNode(
207216
pin.identity,
208217
pin.location,
218+
pin.location,
209219
pin.state.version ?? pin.state.branch ?? pin.state.revision.substring(0, 7),
210220
"remote"
211221
)
@@ -229,6 +239,7 @@ export class PackageDependenciesProvider implements vscode.TreeDataProvider<Tree
229239
new PackageNode(
230240
item.packageRef.identity,
231241
item.state.path!,
242+
item.state.path!,
232243
"local",
233244
"editing"
234245
)
@@ -284,6 +295,7 @@ export class PackageDependenciesProvider implements vscode.TreeDataProvider<Tree
284295
return "remote";
285296
}
286297
}
298+
287299
/**
288300
* Get version of WorkspaceStateDependency for displaying in the tree
289301
* @param dependency
@@ -292,7 +304,7 @@ export class PackageDependenciesProvider implements vscode.TreeDataProvider<Tree
292304
private dependencyDisplayVersion(dependency: WorkspaceStateDependency): string {
293305
const type = this.dependencyType(dependency);
294306
if (type === "editing") {
295-
return "editing"; // ?TODO: get version from `baseOn` node for showing `editing 1.2.3`
307+
return "editing";
296308
} else if (type === "local") {
297309
return "local";
298310
} else {
@@ -306,11 +318,12 @@ export class PackageDependenciesProvider implements vscode.TreeDataProvider<Tree
306318
}
307319

308320
/**
309-
* Get type of WorkspaceStateDependency for displaying in the tree: real version | edited | local
310-
* `edited`: dependency.state.path ?? workspacePath + Packages/ + dependency.subpath
321+
* * Get package source path of dependency
322+
* `editing`: dependency.state.path ?? workspacePath + Packages/ + dependency.subpath
311323
* `local`: dependency.packageRef.location
312324
* `remote`: buildDirectory + checkouts + dependency.packageRef.location
313325
* @param dependency
326+
* @param workspaceFolder
314327
* @return the package path based on the type
315328
*/
316329
private dependencyPackagePath(

0 commit comments

Comments
 (0)