Skip to content

Commit

Permalink
fix: List targets under the right Makefile on a multi-folder workspace
Browse files Browse the repository at this point in the history
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
  • Loading branch information
carlos-algms committed Feb 14, 2022
1 parent 10a1e87 commit ca7c533
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/TreeView/taskTreeBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,25 @@ function getTaskHostFileItem(
task: MakefileTask,
folderItem: FolderItem,
): TaskHostFileItem {
const scope = <vscode.WorkspaceFolder>task.scope;
const { source } = task;
let item: TaskHostFileItem | undefined;

if (task.source === 'Workspace') {
item = map.get(scope.name);
if (source === 'Workspace') {
item = map.get(source);

if (!item) {
item = new TasksJsonItem(folderItem);
map.set(scope.name, item);
map.set(source, item);
folderItem.addChild(item);
}
} else {
const makeFileRelativePath = task.definition.makeFileRelativePath ?? '';
item = map.get(makeFileRelativePath);
const key = `${folderItem.label}-${makeFileRelativePath}`;
item = map.get(key);

if (!item) {
item = new MakefileItem(folderItem, makeFileRelativePath);
map.set(makeFileRelativePath, item);
map.set(key, item);
folderItem.addChild(item);
}
}
Expand Down

0 comments on commit ca7c533

Please sign in to comment.