Skip to content

Commit ca7c533

Browse files
committed
fix: List targets under the right Makefile on a multi-folder workspace
On a multi-folder workspace, all the targets were being listed under the first Makefile. Not it is properly organizing targets under the right host file. Fixes #16
1 parent 10a1e87 commit ca7c533

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/TreeView/taskTreeBuilder.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,25 @@ function getTaskHostFileItem(
5656
task: MakefileTask,
5757
folderItem: FolderItem,
5858
): TaskHostFileItem {
59-
const scope = <vscode.WorkspaceFolder>task.scope;
59+
const { source } = task;
6060
let item: TaskHostFileItem | undefined;
6161

62-
if (task.source === 'Workspace') {
63-
item = map.get(scope.name);
62+
if (source === 'Workspace') {
63+
item = map.get(source);
6464

6565
if (!item) {
6666
item = new TasksJsonItem(folderItem);
67-
map.set(scope.name, item);
67+
map.set(source, item);
6868
folderItem.addChild(item);
6969
}
7070
} else {
7171
const makeFileRelativePath = task.definition.makeFileRelativePath ?? '';
72-
item = map.get(makeFileRelativePath);
72+
const key = `${folderItem.label}-${makeFileRelativePath}`;
73+
item = map.get(key);
7374

7475
if (!item) {
7576
item = new MakefileItem(folderItem, makeFileRelativePath);
76-
map.set(makeFileRelativePath, item);
77+
map.set(key, item);
7778
folderItem.addChild(item);
7879
}
7980
}

0 commit comments

Comments
 (0)