diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/find/findModel.ts b/src/vs/workbench/contrib/notebook/browser/contrib/find/findModel.ts index 1d955dbbcdd..5c58ffda1bc 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/find/findModel.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/find/findModel.ts @@ -471,6 +471,9 @@ export class FindModel extends Disposable { } private async _compute(token: CancellationToken): Promise { + if (!this._notebookEditor.hasModel()) { + return null; + } let ret: CellFindMatchWithIndex[] | null = null; const val = this._state.searchString; const wordSeparators = this._configurationService.inspect('editor.wordSeparators').value; @@ -485,13 +488,8 @@ export class FindModel extends Disposable { includeMarkupPreview: !!this._state.filters?.markupPreview, includeOutput: !!this._state.filters?.codeOutput }; - if (!val) { - ret = null; - } else if (!this._notebookEditor.hasModel()) { - ret = null; - } else { - ret = await this._notebookEditor.find(val, options, token); - } + + ret = await this._notebookEditor.find(val, options, token); if (token.isCancellationRequested) { return null; diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts index 4a3c05451ea..d45c567c327 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts @@ -1610,6 +1610,10 @@ export class BackLayerWebView extends Themable { async find(query: string, options: { wholeWord?: boolean; caseSensitive?: boolean; includeMarkup: boolean; includeOutput: boolean; shouldGetSearchPreviewInfo: boolean; ownerID: string }): Promise { if (query === '') { + this._sendMessageToWebview({ + type: 'findStop', + ownerID: options.ownerID + }); return []; }