Skip to content

Commit bd9ff90

Browse files
authored
Merge branch 'microsoft:main' into aiday/semanticScroll
2 parents 5d16a27 + 35042f5 commit bd9ff90

File tree

5 files changed

+24
-18
lines changed

5 files changed

+24
-18
lines changed

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -593,11 +593,11 @@ class FindFilter<T> implements ITreeFilter<T, FuzzyScore | LabelFuzzyScore>, IDi
593593
}
594594

595595
filter(element: T, parentVisibility: TreeVisibility): TreeFilterResult<FuzzyScore | LabelFuzzyScore> {
596+
let visibility = TreeVisibility.Visible;
597+
596598
if (this._filter) {
597599
const result = this._filter.filter(element, parentVisibility);
598600

599-
let visibility: TreeVisibility;
600-
601601
if (typeof result === 'boolean') {
602602
visibility = result ? TreeVisibility.Visible : TreeVisibility.Hidden;
603603
} else if (isFilterResult(result)) {
@@ -615,7 +615,7 @@ class FindFilter<T> implements ITreeFilter<T, FuzzyScore | LabelFuzzyScore>, IDi
615615

616616
if (!this._pattern) {
617617
this._matchCount++;
618-
return { data: FuzzyScore.Default, visibility: true };
618+
return { data: FuzzyScore.Default, visibility };
619619
}
620620

621621
const label = this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(element);
@@ -624,22 +624,22 @@ class FindFilter<T> implements ITreeFilter<T, FuzzyScore | LabelFuzzyScore>, IDi
624624
for (const l of labels) {
625625
const labelStr = l && l.toString();
626626
if (typeof labelStr === 'undefined') {
627-
return { data: FuzzyScore.Default, visibility: true };
627+
return { data: FuzzyScore.Default, visibility };
628628
}
629629

630630
const score = fuzzyScore(this._pattern, this._lowercasePattern, 0, labelStr, labelStr.toLowerCase(), 0, { firstMatchCanBeWeak: true, boostFullMatch: true });
631631
if (score) {
632632
this._matchCount++;
633633
return labels.length === 1 ?
634-
{ data: score, visibility: true } :
635-
{ data: { label: labelStr, score: score }, visibility: true };
634+
{ data: score, visibility } :
635+
{ data: { label: labelStr, score: score }, visibility };
636636
}
637637
}
638638

639639
if (this.tree.findMode === TreeFindMode.Filter) {
640640
return TreeVisibility.Recurse;
641641
} else {
642-
return { data: FuzzyScore.Default, visibility: true };
642+
return { data: FuzzyScore.Default, visibility };
643643
}
644644
}
645645

@@ -799,7 +799,7 @@ class FindWidget<T, TFilterData> extends Disposable {
799799

800800
layout(width: number = this.width): void {
801801
this.width = width;
802-
this.right = Math.min(Math.max(20, this.right), Math.max(20, width - 170));
802+
this.right = clamp(this.right, 0, Math.max(0, width - 212));
803803
this.elements.root.style.right = `${this.right}px`;
804804
}
805805

@@ -876,7 +876,8 @@ class FindController<T, TFilterData> implements IDisposable {
876876
return;
877877
}
878878

879-
this.widget = new FindWidget(this.view.getHTMLElement(), this.tree, this.contextViewProvider, this._mode, this.styles);
879+
this.mode = this.tree.options.defaultFindMode ?? TreeFindMode.Highlight;
880+
this.widget = new FindWidget(this.view.getHTMLElement(), this.tree, this.contextViewProvider, this.mode, this.styles);
880881
this.enabledDisposables.add(this.widget);
881882

882883
this.widget.onDidChangeValue(this.onDidChangeValue, this, this.enabledDisposables);
@@ -1022,6 +1023,7 @@ export interface IAbstractTreeOptions<T, TFilterData = void> extends IAbstractTr
10221023
readonly filter?: ITreeFilter<T, TFilterData>;
10231024
readonly dnd?: ITreeDragAndDrop<T>;
10241025
readonly additionalScrollHeight?: number;
1026+
readonly findWidgetEnabled?: boolean;
10251027
}
10261028

10271029
function dfs<T, TFilterData>(node: ITreeNode<T, TFilterData>, fn: (node: ITreeNode<T, TFilterData>) => void): void {
@@ -1436,7 +1438,7 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
14361438
onKeyDown.filter(e => e.keyCode === KeyCode.Space).on(this.onSpace, this, this.disposables);
14371439
}
14381440

1439-
if (_options.keyboardNavigationLabelProvider && _options.contextViewProvider) {
1441+
if ((_options.findWidgetEnabled ?? true) && _options.keyboardNavigationLabelProvider && _options.contextViewProvider) {
14401442
this.findController = new FindController(this, this.model, this.view, filter!, _options.contextViewProvider);
14411443
this.focusNavigationFilter = node => this.findController!.shouldAllowFocus(node);
14421444
this.onDidChangeFindOpenState = this.findController.onDidChangeOpenState;

src/vs/base/browser/ui/tree/media/tree.css

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@
7474
display: flex;
7575
padding: 3px;
7676
transition: top 0.3s;
77-
width: 160px;
77+
max-width: 200px;
7878
z-index: 100;
79+
margin: 0 6px;
7980
}
8081

8182
.monaco-tree-type-filter.disabled {
@@ -87,6 +88,7 @@
8788
align-items: center;
8889
justify-content: center;
8990
cursor: grab;
91+
margin-right: 2px;
9092
}
9193

9294
.monaco-tree-type-filter-grab.grabbing {
@@ -98,12 +100,16 @@
98100
}
99101

100102
.monaco-tree-type-filter-input .monaco-inputbox {
101-
height: 26px;
103+
height: 23px;
102104
}
103105

104106
.monaco-tree-type-filter-input .monaco-inputbox > .ibwrapper > .input,
105107
.monaco-tree-type-filter-input .monaco-inputbox > .ibwrapper > .mirror {
106-
padding: 2px;
108+
padding: 2px 4px;
109+
}
110+
111+
.monaco-tree-type-filter-input .monaco-findInput > .controls {
112+
top: 2px;
107113
}
108114

109115
.monaco-tree-type-filter-actionbar {

src/vs/editor/contrib/folding/browser/folding.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,3 @@
3232
cursor: pointer;
3333
}
3434

35-
.monaco-editor .margin-view-overlays .codicon.codicon-folding-manual-expanded::before {
36-
transform: rotate(90deg);
37-
}

src/vs/editor/contrib/folding/browser/foldingDecorations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import { ThemeIcon } from 'vs/platform/theme/common/themeService';
1414

1515
export const foldingExpandedIcon = registerIcon('folding-expanded', Codicon.chevronDown, localize('foldingExpandedIcon', 'Icon for expanded ranges in the editor glyph margin.'));
1616
export const foldingCollapsedIcon = registerIcon('folding-collapsed', Codicon.chevronRight, localize('foldingCollapsedIcon', 'Icon for collapsed ranges in the editor glyph margin.'));
17-
export const foldingManualCollapsedIcon = registerIcon('folding-manual-collapsed', Codicon.ellipsis, localize('foldingManualCollapedIcon', 'Icon for manually collapsed ranges in the editor glyph margin.'));
18-
export const foldingManualExpandedIcon = registerIcon('folding-manual-expanded', Codicon.ellipsis, localize('foldingManualExpandedIcon', 'Icon for manually expanded ranges in the editor glyph margin.'));
17+
export const foldingManualCollapsedIcon = registerIcon('folding-manual-collapsed', foldingCollapsedIcon, localize('foldingManualCollapedIcon', 'Icon for manually collapsed ranges in the editor glyph margin.'));
18+
export const foldingManualExpandedIcon = registerIcon('folding-manual-expanded', foldingExpandedIcon, localize('foldingManualExpandedIcon', 'Icon for manually expanded ranges in the editor glyph margin.'));
1919

2020
export class FoldingDecorationProvider implements IDecorationProvider {
2121

src/vs/workbench/contrib/testing/browser/testingExplorerView.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ export class TestingExplorerViewModel extends Disposable {
491491
keyboardNavigationLabelProvider: instantiationService.createInstance(TreeKeyboardNavigationLabelProvider),
492492
accessibilityProvider: instantiationService.createInstance(ListAccessibilityProvider),
493493
filter: this.filter,
494+
findWidgetEnabled: false
494495
}) as WorkbenchObjectTree<TestExplorerTreeElement, FuzzyScore>;
495496

496497
this._register(this.tree.onDidChangeCollapseState(evt => {

0 commit comments

Comments
 (0)