mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-29 01:25:37 -05:00
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:
@@ -114,6 +114,8 @@ suite('Notebook Editor Model', function (): void {
|
||||
executeEdits: undefined,
|
||||
getSections: undefined,
|
||||
navigateToSection: undefined,
|
||||
cellEditors: undefined,
|
||||
deltaDecorations: undefined,
|
||||
addCell: undefined
|
||||
};
|
||||
});
|
||||
|
||||
@@ -4,14 +4,15 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { nb, IConnectionProfile } from 'azdata';
|
||||
|
||||
import * as vsEvent from 'vs/base/common/event';
|
||||
import { INotebookModel, ICellModel, IClientSession, NotebookContentChange, IKernelPreference } from 'sql/workbench/contrib/notebook/browser/models/modelInterfaces';
|
||||
import { INotebookModel, ICellModel, IClientSession, NotebookContentChange, IKernelPreference, INotebookFindModel } from 'sql/workbench/contrib/notebook/browser/models/modelInterfaces';
|
||||
import { NotebookChangeType, CellType } from 'sql/workbench/contrib/notebook/common/models/contracts';
|
||||
import { INotebookManager, INotebookService, INotebookEditor, ILanguageMagic, INotebookProvider, INavigationProvider, INotebookParams, INotebookSection } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { INotebookManager, INotebookService, INotebookEditor, ILanguageMagic, INotebookProvider, INavigationProvider, INotebookParams, INotebookSection, ICellEditorProvider } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { ISingleNotebookEditOperation } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { IStandardKernelWithProvider } from 'sql/workbench/contrib/notebook/browser/models/notebookUtils';
|
||||
import { URI, Emitter } from 'vs/workbench/workbench.web.api';
|
||||
import { IModelDecorationsChangeAccessor } from 'vs/editor/common/model';
|
||||
import { NotebookRange, NotebookFindMatch } from 'sql/workbench/contrib/notebook/find/notebookFindDecorations';
|
||||
import { URI } from 'vs/workbench/workbench.web.api';
|
||||
import { RenderMimeRegistry } from 'sql/workbench/contrib/notebook/browser/outputs/registry';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
|
||||
@@ -120,6 +121,44 @@ export class NotebookModelStub implements INotebookModel {
|
||||
}
|
||||
}
|
||||
|
||||
export class NotebookFindModelStub implements INotebookFindModel {
|
||||
|
||||
getFindCount(): number {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
getFindIndex(): number {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
findNext(): Promise<NotebookRange> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
findPrevious(): Promise<NotebookRange> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
find(exp: string, maxMatches?: number): Promise<NotebookRange> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
clearFind(): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
findArray: NotebookRange[];
|
||||
getDecorationRange(id: string): NotebookRange {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
changeDecorations<T>(callback: (changeAccessor: IModelDecorationsChangeAccessor) => T, ownerId: number): T {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
getLineMaxColumn(lineNumber: number): number {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
getLineCount(): number {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
findMatches: NotebookFindMatch[];
|
||||
findExpression: string;
|
||||
onFindCountChange: vsEvent.Event<number>;
|
||||
}
|
||||
|
||||
export class NotebookManagerStub implements INotebookManager {
|
||||
providerId: string;
|
||||
contentManager: nb.ContentManager;
|
||||
@@ -128,7 +167,7 @@ export class NotebookManagerStub implements INotebookManager {
|
||||
}
|
||||
|
||||
export class ServerManagerStub implements nb.ServerManager {
|
||||
onServerStartedEmitter = new Emitter<void>();
|
||||
onServerStartedEmitter = new vsEvent.Emitter<void>();
|
||||
onServerStarted: vsEvent.Event<void> = this.onServerStartedEmitter.event;
|
||||
isStarted: boolean = false;
|
||||
calledStart: boolean = false;
|
||||
@@ -386,6 +425,10 @@ export class FutureStub implements nb.IFuture {
|
||||
}
|
||||
|
||||
export class NotebookComponentStub implements INotebookEditor {
|
||||
cellEditors: ICellEditorProvider[];
|
||||
deltaDecorations(newDecorationRange: NotebookRange, oldDecorationRange: NotebookRange): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
get notebookParams(): INotebookParams {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user