Add Search in Cell Selection to Notebook Find Widget (#213409)

* all search scope functionality except cell decorations

* fix filter icon showing fake useage

* decorations + css tweaking + PR feedback
This commit is contained in:
Michael Lively
2024-05-27 22:25:23 -07:00
committed by GitHub
parent 50f2b2eca8
commit 49eedd7d51
17 changed files with 212 additions and 39 deletions

View File

@@ -910,7 +910,18 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD
//#region Find
find(value: string, options: INotebookSearchOptions): CellFindMatchWithIndex[] {
const matches: CellFindMatchWithIndex[] = [];
this._viewCells.forEach((cell, index) => {
let findCells: CellViewModel[] = [];
const selectedRanges = options.selectedRanges?.map(range => this.validateRange(range)).filter(range => !!range);
if (options.searchInRanges && selectedRanges) {
const selectedIndexes = cellRangesToIndexes(selectedRanges);
findCells = selectedIndexes.map(index => this._viewCells[index]);
} else {
findCells = this._viewCells;
}
findCells.forEach((cell, index) => {
const cellMatches = cell.startFind(value, options);
if (cellMatches) {
matches.push(new CellFindMatchModel(