mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-18 18:03:19 +01:00
Merge branch 'microsoft:main' into aiday/semanticScroll
This commit is contained in:
@@ -593,11 +593,11 @@ class FindFilter<T> implements ITreeFilter<T, FuzzyScore | LabelFuzzyScore>, IDi
|
||||
}
|
||||
|
||||
filter(element: T, parentVisibility: TreeVisibility): TreeFilterResult<FuzzyScore | LabelFuzzyScore> {
|
||||
let visibility = TreeVisibility.Visible;
|
||||
|
||||
if (this._filter) {
|
||||
const result = this._filter.filter(element, parentVisibility);
|
||||
|
||||
let visibility: TreeVisibility;
|
||||
|
||||
if (typeof result === 'boolean') {
|
||||
visibility = result ? TreeVisibility.Visible : TreeVisibility.Hidden;
|
||||
} else if (isFilterResult(result)) {
|
||||
@@ -615,7 +615,7 @@ class FindFilter<T> implements ITreeFilter<T, FuzzyScore | LabelFuzzyScore>, IDi
|
||||
|
||||
if (!this._pattern) {
|
||||
this._matchCount++;
|
||||
return { data: FuzzyScore.Default, visibility: true };
|
||||
return { data: FuzzyScore.Default, visibility };
|
||||
}
|
||||
|
||||
const label = this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(element);
|
||||
@@ -624,22 +624,22 @@ class FindFilter<T> implements ITreeFilter<T, FuzzyScore | LabelFuzzyScore>, IDi
|
||||
for (const l of labels) {
|
||||
const labelStr = l && l.toString();
|
||||
if (typeof labelStr === 'undefined') {
|
||||
return { data: FuzzyScore.Default, visibility: true };
|
||||
return { data: FuzzyScore.Default, visibility };
|
||||
}
|
||||
|
||||
const score = fuzzyScore(this._pattern, this._lowercasePattern, 0, labelStr, labelStr.toLowerCase(), 0, { firstMatchCanBeWeak: true, boostFullMatch: true });
|
||||
if (score) {
|
||||
this._matchCount++;
|
||||
return labels.length === 1 ?
|
||||
{ data: score, visibility: true } :
|
||||
{ data: { label: labelStr, score: score }, visibility: true };
|
||||
{ data: score, visibility } :
|
||||
{ data: { label: labelStr, score: score }, visibility };
|
||||
}
|
||||
}
|
||||
|
||||
if (this.tree.findMode === TreeFindMode.Filter) {
|
||||
return TreeVisibility.Recurse;
|
||||
} else {
|
||||
return { data: FuzzyScore.Default, visibility: true };
|
||||
return { data: FuzzyScore.Default, visibility };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -799,7 +799,7 @@ class FindWidget<T, TFilterData> extends Disposable {
|
||||
|
||||
layout(width: number = this.width): void {
|
||||
this.width = width;
|
||||
this.right = Math.min(Math.max(20, this.right), Math.max(20, width - 170));
|
||||
this.right = clamp(this.right, 0, Math.max(0, width - 212));
|
||||
this.elements.root.style.right = `${this.right}px`;
|
||||
}
|
||||
|
||||
@@ -876,7 +876,8 @@ class FindController<T, TFilterData> implements IDisposable {
|
||||
return;
|
||||
}
|
||||
|
||||
this.widget = new FindWidget(this.view.getHTMLElement(), this.tree, this.contextViewProvider, this._mode, this.styles);
|
||||
this.mode = this.tree.options.defaultFindMode ?? TreeFindMode.Highlight;
|
||||
this.widget = new FindWidget(this.view.getHTMLElement(), this.tree, this.contextViewProvider, this.mode, this.styles);
|
||||
this.enabledDisposables.add(this.widget);
|
||||
|
||||
this.widget.onDidChangeValue(this.onDidChangeValue, this, this.enabledDisposables);
|
||||
@@ -1022,6 +1023,7 @@ export interface IAbstractTreeOptions<T, TFilterData = void> extends IAbstractTr
|
||||
readonly filter?: ITreeFilter<T, TFilterData>;
|
||||
readonly dnd?: ITreeDragAndDrop<T>;
|
||||
readonly additionalScrollHeight?: number;
|
||||
readonly findWidgetEnabled?: boolean;
|
||||
}
|
||||
|
||||
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
|
||||
onKeyDown.filter(e => e.keyCode === KeyCode.Space).on(this.onSpace, this, this.disposables);
|
||||
}
|
||||
|
||||
if (_options.keyboardNavigationLabelProvider && _options.contextViewProvider) {
|
||||
if ((_options.findWidgetEnabled ?? true) && _options.keyboardNavigationLabelProvider && _options.contextViewProvider) {
|
||||
this.findController = new FindController(this, this.model, this.view, filter!, _options.contextViewProvider);
|
||||
this.focusNavigationFilter = node => this.findController!.shouldAllowFocus(node);
|
||||
this.onDidChangeFindOpenState = this.findController.onDidChangeOpenState;
|
||||
|
||||
@@ -74,8 +74,9 @@
|
||||
display: flex;
|
||||
padding: 3px;
|
||||
transition: top 0.3s;
|
||||
width: 160px;
|
||||
max-width: 200px;
|
||||
z-index: 100;
|
||||
margin: 0 6px;
|
||||
}
|
||||
|
||||
.monaco-tree-type-filter.disabled {
|
||||
@@ -87,6 +88,7 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: grab;
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
.monaco-tree-type-filter-grab.grabbing {
|
||||
@@ -98,12 +100,16 @@
|
||||
}
|
||||
|
||||
.monaco-tree-type-filter-input .monaco-inputbox {
|
||||
height: 26px;
|
||||
height: 23px;
|
||||
}
|
||||
|
||||
.monaco-tree-type-filter-input .monaco-inputbox > .ibwrapper > .input,
|
||||
.monaco-tree-type-filter-input .monaco-inputbox > .ibwrapper > .mirror {
|
||||
padding: 2px;
|
||||
padding: 2px 4px;
|
||||
}
|
||||
|
||||
.monaco-tree-type-filter-input .monaco-findInput > .controls {
|
||||
top: 2px;
|
||||
}
|
||||
|
||||
.monaco-tree-type-filter-actionbar {
|
||||
|
||||
@@ -32,6 +32,3 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.monaco-editor .margin-view-overlays .codicon.codicon-folding-manual-expanded::before {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ import { ThemeIcon } from 'vs/platform/theme/common/themeService';
|
||||
|
||||
export const foldingExpandedIcon = registerIcon('folding-expanded', Codicon.chevronDown, localize('foldingExpandedIcon', 'Icon for expanded ranges in the editor glyph margin.'));
|
||||
export const foldingCollapsedIcon = registerIcon('folding-collapsed', Codicon.chevronRight, localize('foldingCollapsedIcon', 'Icon for collapsed ranges in the editor glyph margin.'));
|
||||
export const foldingManualCollapsedIcon = registerIcon('folding-manual-collapsed', Codicon.ellipsis, localize('foldingManualCollapedIcon', 'Icon for manually collapsed ranges in the editor glyph margin.'));
|
||||
export const foldingManualExpandedIcon = registerIcon('folding-manual-expanded', Codicon.ellipsis, localize('foldingManualExpandedIcon', 'Icon for manually expanded ranges in the editor glyph margin.'));
|
||||
export const foldingManualCollapsedIcon = registerIcon('folding-manual-collapsed', foldingCollapsedIcon, localize('foldingManualCollapedIcon', 'Icon for manually collapsed ranges in the editor glyph margin.'));
|
||||
export const foldingManualExpandedIcon = registerIcon('folding-manual-expanded', foldingExpandedIcon, localize('foldingManualExpandedIcon', 'Icon for manually expanded ranges in the editor glyph margin.'));
|
||||
|
||||
export class FoldingDecorationProvider implements IDecorationProvider {
|
||||
|
||||
|
||||
@@ -491,6 +491,7 @@ export class TestingExplorerViewModel extends Disposable {
|
||||
keyboardNavigationLabelProvider: instantiationService.createInstance(TreeKeyboardNavigationLabelProvider),
|
||||
accessibilityProvider: instantiationService.createInstance(ListAccessibilityProvider),
|
||||
filter: this.filter,
|
||||
findWidgetEnabled: false
|
||||
}) as WorkbenchObjectTree<TestExplorerTreeElement, FuzzyScore>;
|
||||
|
||||
this._register(this.tree.onDidChangeCollapseState(evt => {
|
||||
|
||||
Reference in New Issue
Block a user