Skip to content

Commit 031625b

Browse files
authored
fix: delete files on multiple workspace (#4449)
1 parent 59a251c commit 031625b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/file-tree-next/src/browser/file-tree.service.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,11 @@ export class FileTreeService extends Tree implements IFileTreeService {
628628
if (rootUri.isEqualOrParent(pathURI)) {
629629
const relativePath = rootUri.relative(pathURI);
630630
if (relativePath) {
631-
path = new Path(this.root.path).join(relativePath.toString()).toString();
631+
if (this.isMultipleWorkspace) {
632+
path = new Path(this.root.path).join(rootUri.displayName).join(relativePath.toString()).toString();
633+
} else {
634+
path = new Path(this.root.path).join(relativePath.toString()).toString();
635+
}
632636
}
633637
}
634638
}
@@ -726,16 +730,16 @@ export class FileTreeService extends Tree implements IFileTreeService {
726730
/**
727731
* 将文件排序并删除多余文件(指已有父文件夹将被删除)
728732
*/
729-
public sortPaths(_paths: (string | URI)[]) {
730-
const paths = _paths.slice();
733+
public sortPaths(pathOrUri: (string | URI)[]) {
734+
const paths = pathOrUri.slice();
731735
const nodes = paths
732736
.map((path) => ({
733737
node: this.getNodeByPathOrUri(path),
734738
path,
735739
}))
736740
.filter((node) => node && !!node.node) as ISortNode[];
737741

738-
if (_paths.length > 1) {
742+
if (pathOrUri.length > 1) {
739743
nodes.sort((pathA, pathB) => {
740744
// 直接获取节点深度比通过path取深度更可靠
741745
const pathADepth = pathA.node?.depth || 0;

0 commit comments

Comments
 (0)