Skip to content

Commit 16a32fa

Browse files
authored
Fix Tree Sticky Scroll compression with workbench.tree.stickyScrollMaxItemCount = 1 (microsoft#209005)
fix microsoft#204613
1 parent edfd5b8 commit 16a32fa

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/vs/base/browser/ui/tree/objectTree.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,20 @@ class CompressibleStickyScrollDelegate<T, TFilterData> implements IStickyScrollD
192192
if (stickyNodes.length === 0) {
193193
throw new Error('Can\'t compress empty sticky nodes');
194194
}
195-
196-
if (!this.modelProvider().isCompressionEnabled()) {
195+
const compressionModel = this.modelProvider();
196+
if (!compressionModel.isCompressionEnabled()) {
197197
return stickyNodes[0];
198198
}
199199

200200
// Collect all elements to be compressed
201201
const elements: T[] = [];
202-
for (const stickyNode of stickyNodes) {
203-
const compressedNode = this.modelProvider().getCompressedTreeNode(stickyNode.node.element);
202+
for (let i = 0; i < stickyNodes.length; i++) {
203+
const stickyNode = stickyNodes[i];
204+
const compressedNode = compressionModel.getCompressedTreeNode(stickyNode.node.element);
204205

205206
if (compressedNode.element) {
206-
if (compressedNode.element.incompressible) {
207+
// if an element is incompressible, it can't be compressed with it's parent element
208+
if (i !== 0 && compressedNode.element.incompressible) {
207209
break;
208210
}
209211
elements.push(...compressedNode.element.elements);

0 commit comments

Comments
 (0)