Skip to content

Commit

Permalink
fix: explorer occassionally hangs / stops responding [fixes #143]
Browse files Browse the repository at this point in the history
  • Loading branch information
spmeesseman committed Jun 6, 2021
1 parent ce9c8f0 commit a68166e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
12 changes: 12 additions & 0 deletions src/tree/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,18 @@ export default class TaskFile extends TreeItem
}
}

if (source === "app-publisher")
{ //
// For ap files in the same dir, nsamed with a tag, e.g.:
// .publishrc.spm.json
//
const match = taskDef.fileName.match(/\.publishrc\.(.+)\.(?:js(?:on)?|ya?ml)$/i);
if (match && match.length > 1 && match[1])
{
return (label + " (" + match[1].toLowerCase() + ")");
}
}

//
// Reference ticket #133, vscode folder should not use a path appendature in it's folder label
// in the task tree, there is only one path for vscode/workspace tasks, /.vscode. The fact that
Expand Down
18 changes: 13 additions & 5 deletions src/tree/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export class TaskTreeDataProvider implements TreeDataProvider<TreeItem>
if (key === constants.LAST_TASKS_LABEL || key === constants.FAV_TASKS_LABEL) {
continue;
}
await this.sortFolder(folder, logPad + " ");
this.sortFolder(folder, logPad + " ");
//
// Create groupings by task type
//
Expand Down Expand Up @@ -543,7 +543,9 @@ export class TaskTreeDataProvider implements TreeDataProvider<TreeItem>
subfolder.addTreeNode(prevTaskFile); // addScript will set the group level on the TaskItem
}
}
subfolder?.addTreeNode(each); // addScript will set the group level on the TaskItem
if (subfolder && subfolder.nodePath !== each.nodePath) {
subfolder.addTreeNode(each); // addScript will set the group level on the TaskItem
}
}
prevTaskFile = each;
//
Expand Down Expand Up @@ -574,7 +576,7 @@ export class TaskTreeDataProvider implements TreeDataProvider<TreeItem>
//
// Resort after making adds/removes
//
await this.sortFolder(folder, logPad + " ");
this.sortFolder(folder, logPad + " ");

log.methodDone("create tree node folder grouping", 1, logPad);
}
Expand Down Expand Up @@ -1060,6 +1062,12 @@ export class TaskTreeDataProvider implements TreeDataProvider<TreeItem>
{
id += labelSplit[i];
}
if (file.resourceUri) {
id += file.resourceUri.fsPath.replace(/\W/gi, "");
}
else if (file.fileName) {
id += file.fileName.replace(/\W/gi, "");
}
return folder.label + file.taskSource + id + (treeLevel || treeLevel === 0 ? treeLevel.toString() : "");
}

Expand Down Expand Up @@ -2094,7 +2102,7 @@ export class TaskTreeDataProvider implements TreeDataProvider<TreeItem>
taskFile.removeTreeNode(each2);
}

log.methodStart("remove scripts", 3, logPad);
log.methodDone("remove scripts", 1, logPad);
}


Expand Down Expand Up @@ -2538,7 +2546,7 @@ export class TaskTreeDataProvider implements TreeDataProvider<TreeItem>
}


private async sortFolder(folder: TaskFolder, logPad = "")
private sortFolder(folder: TaskFolder, logPad = "")
{
this.sortTasks(folder.taskFiles, logPad);
for (const each of folder.taskFiles)
Expand Down

0 comments on commit a68166e

Please sign in to comment.