Skip to content

Commit 74f072e

Browse files
committed
edits for clarity
1 parent 6a2e524 commit 74f072e

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/features/views/projectView.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,16 @@ export class ProjectView implements TreeDataProvider<ProjectTreeItem> {
124124
return element.treeItem;
125125
}
126126

127+
/**
128+
* Returns the children of a given element in the project tree view:
129+
* If param is undefined, return root project items
130+
* If param is a project, returns its environments.
131+
* If param is an environment, returns its packages.
132+
* @param element The tree item for which to get children.
133+
*/
127134
async getChildren(element?: ProjectTreeItem | undefined): Promise<ProjectTreeItem[] | undefined> {
128135
if (element === undefined) {
136+
// Return the root items
129137
this.projectViews.clear();
130138
const views: ProjectTreeItem[] = [];
131139
const projects = this.projectManager.getProjects();
@@ -186,6 +194,8 @@ export class ProjectView implements TreeDataProvider<ProjectTreeItem> {
186194
}
187195

188196
if (element.kind === ProjectTreeItemKind.environment) {
197+
// Return packages directly under the environment
198+
189199
const environmentItem = element as ProjectEnvironment;
190200
const parent = environmentItem.parent;
191201
const uri = parent.id === 'global' ? undefined : parent.project.uri;
@@ -204,12 +214,10 @@ export class ProjectView implements TreeDataProvider<ProjectTreeItem> {
204214
// Store the reference for refreshing packages
205215
this.packageRoots.set(uri ? uri.fsPath : 'global', environmentItem);
206216

207-
// Return packages directly under the environment
208217
return packages.map((p) => new ProjectPackage(environmentItem, p, pkgManager));
209218
}
210219

211-
// We no longer need to handle packageRoot items as they are not created anymore
212-
220+
//return nothing if the element is not a project, environment, or undefined
213221
return undefined;
214222
}
215223
getParent(element: ProjectTreeItem): ProviderResult<ProjectTreeItem> {

0 commit comments

Comments
 (0)