mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 06:38:23 +00:00
fixed bug with collapsing compressed nodes (#162222)
fixed bug with collapsing compression nodes
This commit is contained in:
parent
dd4d29dd8b
commit
fec2b499d5
3 changed files with 23 additions and 3 deletions
|
@ -292,14 +292,21 @@ export function collapseDeepestExpandedLevel(accessor: ServicesAccessor) {
|
|||
let canCollapseFileMatchLevel = false;
|
||||
let canCollapseFirstLevel = false;
|
||||
|
||||
if (node instanceof FolderMatch) {
|
||||
if (node instanceof FolderMatchWorkspaceRoot) {
|
||||
while (node = navigator.next()) {
|
||||
if (node instanceof Match) {
|
||||
canCollapseFileMatchLevel = true;
|
||||
break;
|
||||
}
|
||||
if (searchView.isTreeLayoutViewVisible && !canCollapseFirstLevel) {
|
||||
const immediateParent = node.parent();
|
||||
let nodeToTest = node;
|
||||
|
||||
if (node instanceof FolderMatch) {
|
||||
nodeToTest = node.compressionStartParent ?? node;
|
||||
}
|
||||
|
||||
const immediateParent = nodeToTest.parent();
|
||||
|
||||
if (!(immediateParent instanceof FolderMatchWorkspaceRoot || immediateParent instanceof FolderMatchNoRoot || immediateParent instanceof SearchResult)) {
|
||||
canCollapseFirstLevel = true;
|
||||
}
|
||||
|
@ -318,7 +325,14 @@ export function collapseDeepestExpandedLevel(accessor: ServicesAccessor) {
|
|||
node = navigator.first();
|
||||
if (node) {
|
||||
do {
|
||||
const immediateParent = node.parent();
|
||||
|
||||
let nodeToTest = node;
|
||||
|
||||
if (node instanceof FolderMatch) {
|
||||
nodeToTest = node.compressionStartParent ?? node;
|
||||
}
|
||||
const immediateParent = nodeToTest.parent();
|
||||
|
||||
if (immediateParent instanceof FolderMatchWorkspaceRoot || immediateParent instanceof FolderMatchNoRoot) {
|
||||
if (viewer.hasElement(node)) {
|
||||
viewer.collapse(node, true);
|
||||
|
|
|
@ -95,6 +95,7 @@ export class FolderMatchRenderer extends Disposable implements ICompressibleTree
|
|||
renderCompressedElements(node: ITreeNode<ICompressedTreeNode<FolderMatch>, any>, index: number, templateData: IFolderMatchTemplate, height: number | undefined): void {
|
||||
const compressed = node.element;
|
||||
const folder = compressed.elements[compressed.elements.length - 1];
|
||||
folder.compressionStartParent = compressed.elements[0];
|
||||
const label = compressed.elements.map(e => e.name());
|
||||
|
||||
if (folder.resource) {
|
||||
|
@ -134,6 +135,7 @@ export class FolderMatchRenderer extends Disposable implements ICompressibleTree
|
|||
|
||||
renderElement(node: ITreeNode<FolderMatch, any>, index: number, templateData: IFolderMatchTemplate): void {
|
||||
const folderMatch = node.element;
|
||||
folderMatch.compressionStartParent = undefined;
|
||||
if (folderMatch.resource) {
|
||||
const workspaceFolder = this.contextService.getWorkspaceFolder(folderMatch.resource);
|
||||
if (workspaceFolder && isEqual(workspaceFolder.uri, folderMatch.resource)) {
|
||||
|
|
|
@ -492,6 +492,10 @@ export class FolderMatch extends Disposable {
|
|||
protected _unDisposedFileMatches: ResourceMap<FileMatch>;
|
||||
protected _unDisposedFolderMatches: ResourceMap<FolderMatchWithResource>;
|
||||
private _replacingAll: boolean = false;
|
||||
|
||||
// if this is compressed in a node with other FolderMatches, then this is set to the parent where compression starts
|
||||
public compressionStartParent: FolderMatch | undefined;
|
||||
|
||||
constructor(
|
||||
protected _resource: URI | null,
|
||||
private _id: string,
|
||||
|
|
Loading…
Reference in a new issue