Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for 'Can't compress when there are no elements to compress' error #202804

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/vs/base/browser/ui/tree/objectTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ class CompressibleStickyScrollDelegate<T, TFilterData> implements IStickyScrollD

private compressStickyNodes(stickyNodes: StickyScrollNode<T, TFilterData>[]): StickyScrollNode<T, TFilterData> {

if (stickyNodes.length === 0) {
throw new Error('Can\'t compress empty sticky nodes');
}

if (!this.modelProvider().isCompressionEnabled()) {
return stickyNodes[0];
}
Expand All @@ -206,11 +210,7 @@ class CompressibleStickyScrollDelegate<T, TFilterData> implements IStickyScrollD
}
}

if (elements.length === 0) {
throw new Error('Can\'t compress when there are no elements to compress');
}

if (elements.length === 1) {
if (elements.length < 2) {
return stickyNodes[0];
}

Expand Down