Books/search within notebook (#8426)

* initial commit

* get notebook content

* skeleton for find in notebookModel

* add search function and keyboard shortcut

* add command for hiding find widget

* started on search logic

* continue search logic

* continue search logic

* add findcountchange listener

* notebook find position

* added css class

* hide find widget

* focus find input

* search for multiple occurrences in one line

* start notebook find decorations

* start adding decorations to notebook model

* added editor_model_defaults

* added cursor position

* merged master and resolved husky erros

* initial changes added to Lucyls base implementation

* pass NotebbokRange instead of Range to decorations

* changes after merging master

* temp changes for testing

* style updates from vscode merge

* implemented the empty methods and added supporting functionality from textModel

* just a little error checking

* It gets more and more yellow

* making highlight work between code cells

* highlight only word

* remove highlight on close and maintain the position

* cleanup of unused references

* clean up

* find between code cells refactored

* highlight markdown line and scroll to it

* find index fix

* find index fix

* code clean up

* remove commented code

* tslint fix for: Cannot use global 'NodeJS'

* linting rule fixes

* deltaDecoration base implementation on the base class

* moced class defnitions from interface fikle

* updated action names

* DOM.addClass instead of overwriting

* resooved conflicts

* moved 'find' code away from notebookmodel to sep class

* moved find realted code to seperate folder

* created notebookFindModel

* clean up

* highlight color changes

* spacing and typo fixes

* highlight correct element for nested elements

* do not iterate through paragraphs and li

* find accross notebooks

* keep track of index

* clear decorations on close

* floating promises

* maintain search context

Co-authored-by: Lucy Zhang <lucyzhang929@gmail.com>
Co-authored-by: Chris LaFreniere <40371649+chlafreniere@users.noreply.github.com>
This commit is contained in:
Maddy
2019-12-19 17:21:03 -08:00
committed by GitHub
parent 102d820935
commit 778a34a9d2
22 changed files with 2236 additions and 41 deletions

View File

@@ -20,6 +20,8 @@ import { NotebookModel } from 'sql/workbench/contrib/notebook/browser/models/not
import { ICommandService } from 'vs/platform/commands/common/commands';
import { CellType } from 'sql/workbench/contrib/notebook/common/models/contracts';
import { getErrorMessage } from 'vs/base/common/errors';
import { IEditorAction } from 'vs/editor/common/editorCommon';
import { IFindNotebookController } from 'sql/workbench/contrib/notebook/find/notebookFindWidget';
import { INotebookModel } from 'sql/workbench/contrib/notebook/browser/models/modelInterfaces';
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerService';
import { TreeUpdateUtils } from 'sql/workbench/contrib/objectExplorer/browser/treeUpdateUtils';
@@ -425,3 +427,35 @@ export class NewNotebookAction extends Action {
return this.commandService.executeCommand(NewNotebookAction.INTERNAL_NEW_NOTEBOOK_CMD_ID, { connectionProfile: connProfile });
}
}
export class NotebookFindNextAction implements IEditorAction {
public readonly id = 'notebook.findNext';
public readonly label = localize('notebook.findNext', "Find Next String");
public readonly alias = '';
constructor(private notebook: IFindNotebookController) { }
async run(): Promise<void> {
await this.notebook.findNext();
}
isSupported(): boolean {
return true;
}
}
export class NotebookFindPreviousAction implements IEditorAction {
public readonly id = 'notebook.findPrevious';
public readonly label = localize('notebook.findPrevious', "Find Previous String");
public readonly alias = '';
constructor(private notebook: IFindNotebookController) { }
async run(): Promise<void> {
await this.notebook.findPrevious();
}
isSupported(): boolean {
return true;
}
}