mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 01:25:37 -05:00
Fix for Sqlproj tree bug (#10605)
Fixes bug where files located in a subfolder defined before the folders themselves in .sqlproj would result in those files not appearing in the ADS treeview
This commit is contained in:
@@ -32,14 +32,7 @@ export class ProjectRootTreeItem extends BaseProjectTreeItem {
|
||||
const output: BaseProjectTreeItem[] = [];
|
||||
output.push(this.dataSourceNode);
|
||||
|
||||
// sort children so that folders come first, then alphabetical
|
||||
const sortedChildren = Object.values(this.fileChildren).sort((a: (fileTree.FolderNode | fileTree.FileNode), b: (fileTree.FolderNode | fileTree.FileNode)) => {
|
||||
if (a instanceof fileTree.FolderNode && !(b instanceof fileTree.FolderNode)) { return -1; }
|
||||
else if (!(a instanceof fileTree.FolderNode) && b instanceof fileTree.FolderNode) { return 1; }
|
||||
else { return a.uri.fsPath.localeCompare(b.uri.fsPath); }
|
||||
});
|
||||
|
||||
return output.concat(sortedChildren);
|
||||
return output.concat(Object.values(this.fileChildren).sort(fileTree.sortFileFolderNodes));
|
||||
}
|
||||
|
||||
public get treeItem(): vscode.TreeItem {
|
||||
@@ -53,6 +46,10 @@ export class ProjectRootTreeItem extends BaseProjectTreeItem {
|
||||
for (const entry of this.project.files) {
|
||||
const parentNode = this.getEntryParentNode(entry);
|
||||
|
||||
if (Object.keys(parentNode.fileChildren).includes(path.basename(entry.fsUri.path))) {
|
||||
continue; // ignore duplicate entries
|
||||
}
|
||||
|
||||
let newNode: fileTree.FolderNode | fileTree.FileNode;
|
||||
|
||||
switch (entry.type) {
|
||||
|
||||
Reference in New Issue
Block a user