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

@@ -16,6 +16,8 @@ import { ISingleNotebookEditOperation } from 'sql/workbench/api/common/sqlExtHos
import { ICellModel, INotebookModel } from 'sql/workbench/contrib/notebook/browser/models/modelInterfaces';
import { NotebookChangeType, CellType } from 'sql/workbench/contrib/notebook/common/models/contracts';
import { IBootstrapParams } from 'sql/workbench/services/bootstrap/common/bootstrapParams';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
import { NotebookRange } from 'sql/workbench/contrib/notebook/find/notebookFindDecorations';
export const SERVICE_ID = 'notebookService';
export const INotebookService = createDecorator<INotebookService>(SERVICE_ID);
@@ -143,10 +145,18 @@ export interface INotebookSection {
relativeUri: string;
}
export interface ICellEditorProvider {
hasEditor(): boolean;
cellGuid(): string;
getEditor(): BaseTextEditor;
deltaDecorations(newDecorationRange: NotebookRange, oldDecorationRange: NotebookRange): void;
}
export interface INotebookEditor {
readonly notebookParams: INotebookParams;
readonly id: string;
readonly cells?: ICellModel[];
readonly cellEditors: ICellEditorProvider[];
readonly modelReady: Promise<INotebookModel>;
readonly model: INotebookModel | null;
isDirty(): boolean;
@@ -159,6 +169,7 @@ export interface INotebookEditor {
clearAllOutputs(): Promise<boolean>;
getSections(): INotebookSection[];
navigateToSection(sectionId: string): void;
deltaDecorations(newDecorationRange: NotebookRange, oldDecorationRange: NotebookRange): void;
addCell(cellType: CellType, index?: number, event?: Event);
}