mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-22 09:38:38 +01:00
Notebook Find Match content/webview polish. (#166913)
* Notebook Find Match content/webview polish.
* 💄
* remove irrelevant file
This commit is contained in:
@@ -22,7 +22,7 @@ import { ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
import { FoldingRegions } from 'vs/editor/contrib/folding/browser/foldingRanges';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
|
||||
import { CellEditState, CellFindMatch, CellFindMatchWithIndex, CellFoldingState, EditorFoldingStateDelegate, ICellViewModel, INotebookDeltaCellStatusBarItems, INotebookDeltaDecoration, OutputFindMatch, ICellModelDecorations, ICellModelDeltaDecorations, IModelDecorationsChangeAccessor, INotebookEditorViewState, INotebookViewCellsUpdateEvent, INotebookViewModel } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
|
||||
import { CellEditState, CellFindMatchWithIndex, CellFoldingState, EditorFoldingStateDelegate, ICellViewModel, INotebookDeltaCellStatusBarItems, INotebookDeltaDecoration, ICellModelDecorations, ICellModelDeltaDecorations, IModelDecorationsChangeAccessor, INotebookEditorViewState, INotebookViewCellsUpdateEvent, INotebookViewModel } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
|
||||
import { NotebookCellSelectionCollection } from 'vs/workbench/contrib/notebook/browser/viewModel/cellSelectionCollection';
|
||||
import { CodeCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel';
|
||||
import { MarkupCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel';
|
||||
@@ -32,6 +32,7 @@ import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/no
|
||||
import { CellKind, ICell, INotebookSearchOptions, ISelectionState, NotebookCellsChangeType, NotebookCellTextModelSplice, SelectionStateType } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
import { cellIndexesToRanges, cellRangesToIndexes, ICellRange, reduceCellRanges } from 'vs/workbench/contrib/notebook/common/notebookRange';
|
||||
import { NotebookLayoutInfo, NotebookMetadataChangedEvent } from 'vs/workbench/contrib/notebook/browser/notebookViewEvents';
|
||||
import { CellFindMatchModel } from 'vs/workbench/contrib/notebook/browser/contrib/find/findModel';
|
||||
|
||||
const invalidFunc = () => { throw new Error(`Invalid change accessor`); };
|
||||
|
||||
@@ -891,12 +892,12 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD
|
||||
this._viewCells.forEach((cell, index) => {
|
||||
const cellMatches = cell.startFind(value, options);
|
||||
if (cellMatches) {
|
||||
matches.push({
|
||||
cell: cellMatches.cell,
|
||||
index: index,
|
||||
matches: cellMatches.matches,
|
||||
modelMatchCount: cellMatches.matches.length
|
||||
});
|
||||
matches.push(new CellFindMatchModel(
|
||||
cellMatches.cell,
|
||||
index,
|
||||
cellMatches.contentMatches,
|
||||
[]
|
||||
));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -914,7 +915,7 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD
|
||||
});
|
||||
}
|
||||
|
||||
async replaceAll(matches: CellFindMatch[], texts: string[]): Promise<void> {
|
||||
async replaceAll(matches: CellFindMatchWithIndex[], texts: string[]): Promise<void> {
|
||||
if (!matches.length) {
|
||||
return;
|
||||
}
|
||||
@@ -923,14 +924,12 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD
|
||||
this._lastNotebookEditResource.push(matches[0].cell.uri);
|
||||
|
||||
matches.forEach(match => {
|
||||
match.matches.forEach((singleMatch, index) => {
|
||||
if ((singleMatch as OutputFindMatch).index === undefined) {
|
||||
textEdits.push({
|
||||
versionId: undefined,
|
||||
textEdit: { range: (singleMatch as FindMatch).range, text: texts[index] },
|
||||
resource: match.cell.uri
|
||||
});
|
||||
}
|
||||
match.contentMatches.forEach((singleMatch, index) => {
|
||||
textEdits.push({
|
||||
versionId: undefined,
|
||||
textEdit: { range: (singleMatch as FindMatch).range, text: texts[index] },
|
||||
resource: match.cell.uri
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user