-
Notifications
You must be signed in to change notification settings - Fork 29.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to search in notebook inputs (under experimental flag) #167952
Changes from all commits
f895929
03ad467
cc1a778
6bba961
75dddd2
b7f40ea
ac5a174
90763cc
e37722e
d20ea1d
188ee99
51c667e
65337b5
da22b6a
779e721
b8c5133
15ea8bc
310c13a
a782747
f262935
eff7d26
b1e69a1
136438c
7b97332
349b100
d11d169
4cd6107
5409745
a368db1
917ac78
aa79ffc
99c2baa
3cbc5af
b4c213e
2bfad50
9d16b92
8255fc5
350ed49
3c94737
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -666,7 +666,7 @@ export interface INotebookEditor { | |
getNextVisibleCellIndex(index: number): number | undefined; | ||
getPreviousVisibleCellIndex(index: number): number | undefined; | ||
find(query: string, options: INotebookSearchOptions, token: CancellationToken): Promise<CellFindMatchWithIndex[]>; | ||
highlightFind(cell: ICellViewModel, matchIndex: number): Promise<number>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this argument wasn't be used by the implementation |
||
highlightFind(matchIndex: number): Promise<number>; | ||
unHighlightFind(matchIndex: number): Promise<void>; | ||
findStop(): void; | ||
showProgress(): void; | ||
|
@@ -730,8 +730,17 @@ export interface IActiveNotebookEditorDelegate extends INotebookEditorDelegate { | |
getNextVisibleCellIndex(index: number): number; | ||
} | ||
|
||
export interface ISearchPreviewInfo { | ||
line: string; | ||
range: { | ||
start: number; | ||
end: number; | ||
}; | ||
} | ||
|
||
export interface CellWebviewFindMatch { | ||
readonly index: number; | ||
readonly searchPreviewInfo?: ISearchPreviewInfo; | ||
} | ||
|
||
export type CellContentFindMatch = FindMatch; | ||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -124,6 +124,8 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD | |||
readonly onDidChangeCellState = this._onDidChangeCellState.event; | ||||
private readonly _onDidChangeViewCells = this._register(new Emitter<INotebookViewCellsUpdateEvent>()); | ||||
readonly onDidChangeViewCells: Event<INotebookViewCellsUpdateEvent> = this._onDidChangeViewCells.event; | ||||
private readonly _onWillChangeModel = this._register(new Emitter<NotebookTextModel | undefined>()); | ||||
readonly onWillChangeModel: Event<NotebookTextModel | undefined> = this._onWillChangeModel.event; | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not seeing where this is used? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's used here
|
||||
private readonly _onDidChangeModel = this._register(new Emitter<NotebookTextModel | undefined>()); | ||||
readonly onDidChangeModel: Event<NotebookTextModel | undefined> = this._onDidChangeModel.event; | ||||
private readonly _onDidChangeOptions = this._register(new Emitter<void>()); | ||||
|
@@ -157,7 +159,6 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD | |||
private readonly _onDidResizeOutputEmitter = this._register(new Emitter<ICellViewModel>()); | ||||
readonly onDidResizeOutput = this._onDidResizeOutputEmitter.event; | ||||
|
||||
|
||||
//#endregion | ||||
private _overlayContainer!: HTMLElement; | ||||
private _notebookTopToolbarContainer!: HTMLElement; | ||||
|
@@ -208,6 +209,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD | |||
} | ||||
|
||||
set viewModel(newModel: NotebookViewModel | undefined) { | ||||
this._onWillChangeModel.fire(this._notebookViewModel?.notebookDocument); | ||||
this._notebookViewModel = newModel; | ||||
this._onDidChangeModel.fire(newModel?.notebookDocument); | ||||
} | ||||
|
@@ -2459,7 +2461,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD | |||
return ret; | ||||
} | ||||
|
||||
async highlightFind(cell: CodeCellViewModel, matchIndex: number): Promise<number> { | ||||
async highlightFind(matchIndex: number): Promise<number> { | ||||
if (!this._webview) { | ||||
return 0; | ||||
} | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I split Find Match and Webview Match highlight into different functions, since search needs this. Caller is responsible for calling the correct function.