Consolidate INotebookEditOperation interfaces (#17944)

This commit is contained in:
Charles Gagnon
2021-12-17 14:21:52 -08:00
committed by GitHub
parent 2a681605fa
commit 2bef6d36b0
3 changed files with 10 additions and 13 deletions

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Component, Input, ViewChildren, QueryList, ChangeDetectorRef, forwardRef, Inject, ViewChild, ElementRef, ViewContainerRef, ComponentFactoryResolver } from '@angular/core';
import { ICellModel, INotebookModel, ISingleNotebookEditOperation, NotebookContentChange } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
import { ICellModel, INotebookModel, NotebookContentChange } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
import 'vs/css!./notebookViewsGrid';
import { CodeCellComponent } from 'sql/workbench/contrib/notebook/browser/cellViews/codeCell.component';
import { TextCellComponent } from 'sql/workbench/contrib/notebook/browser/cellViews/textCell.component';
@@ -37,6 +37,7 @@ import * as DOM from 'vs/base/browser/dom';
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { LabeledMenuItemActionItem } from 'sql/platform/actions/browser/menuEntryActionViewItem';
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { INotebookEditOperation } from 'sql/workbench/api/common/extHostNotebookEditor';
export const NOTEBOOKVIEWS_SELECTOR: string = 'notebook-view-component';
@@ -104,7 +105,7 @@ export class NotebookViewComponent extends AngularDisposable implements INoteboo
let notebookEditor = this.notebookParams.input;
return this._editorService.visibleEditors.some(e => e.matches(notebookEditor));
}
executeEdits(edits: ISingleNotebookEditOperation[]): boolean {
executeEdits(edits: INotebookEditOperation[]): boolean {
throw new Error('Method not implemented.');
}
async runCell(cell: ICellModel): Promise<boolean> {

View File

@@ -5,7 +5,7 @@
import { nb, IConnectionProfile } from 'azdata';
import * as vsEvent from 'vs/base/common/event';
import { INotebookModel, ICellModel, IClientSession, NotebookContentChange, ISingleNotebookEditOperation, MoveDirection, ViewMode } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
import { INotebookModel, ICellModel, IClientSession, NotebookContentChange, MoveDirection, ViewMode } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
import { INotebookFindModel } from 'sql/workbench/contrib/notebook/browser/models/notebookFindModel';
import { NotebookChangeType, CellType } from 'sql/workbench/services/notebook/common/contracts';
import { IExecuteManager, INotebookService, INotebookEditor, ILanguageMagic, IExecuteProvider, INavigationProvider, INotebookParams, INotebookSection, ICellEditorProvider, NotebookRange, ISerializationProvider, ISerializationManager } from 'sql/workbench/services/notebook/browser/notebookService';
@@ -23,6 +23,7 @@ import { NotebookViewsExtension } from 'sql/workbench/services/notebook/browser/
import { INotebookView, INotebookViewCell, INotebookViewMetadata, INotebookViews } from 'sql/workbench/services/notebook/browser/notebookViews/notebookViews';
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
import { ITelemetryEventProperties } from 'sql/platform/telemetry/common/telemetry';
import { INotebookEditOperation } from 'sql/workbench/api/common/extHostNotebookEditor';
export class NotebookModelStub implements INotebookModel {
constructor(private _languageInfo?: nb.ILanguageInfo, private _cells?: ICellModel[], private _testContents?: nb.INotebookContents) {
@@ -130,7 +131,7 @@ export class NotebookModelStub implements INotebookModel {
deleteCell(cellModel: ICellModel): void {
throw new Error('Method not implemented.');
}
pushEditOperations(edits: ISingleNotebookEditOperation[]): void {
pushEditOperations(edits: INotebookEditOperation[]): void {
throw new Error('Method not implemented.');
}
getApplicableConnectionProviderIds(kernelName: string): string[] {
@@ -524,7 +525,7 @@ export class NotebookComponentStub implements INotebookEditor {
isVisible(): boolean {
throw new Error('Method not implemented.');
}
executeEdits(edits: ISingleNotebookEditOperation[]): boolean {
executeEdits(edits: INotebookEditOperation[]): boolean {
throw new Error('Method not implemented.');
}
runCell(cell: ICellModel): Promise<boolean> {
@@ -720,7 +721,7 @@ export class NotebookEditorStub implements INotebookEditor {
isVisible(): boolean {
throw new Error('Method not implemented.');
}
executeEdits(edits: ISingleNotebookEditOperation[]): boolean {
executeEdits(edits: INotebookEditOperation[]): boolean {
throw new Error('Method not implemented.');
}
runCell(cell: ICellModel): Promise<boolean> {

View File

@@ -26,6 +26,7 @@ import { QueryResultId } from 'sql/workbench/services/notebook/browser/models/ce
import { IPosition } from 'vs/editor/common/core/position';
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
import { ITelemetryEventProperties } from 'sql/platform/telemetry/common/telemetry';
import { INotebookEditOperation } from 'sql/workbench/api/common/extHostNotebookEditor';
export enum ViewMode {
@@ -38,12 +39,6 @@ export interface ICellRange {
readonly end: number;
}
export interface ISingleNotebookEditOperation {
range: ICellRange;
cell: Partial<nb.ICellContents>;
forceMoveMarkers: boolean;
}
export interface IClientSessionOptions {
notebookUri: URI;
executeManager: IExecuteManager;
@@ -421,7 +416,7 @@ export interface INotebookModel {
* editing the model. Long-term, this will ensure edit operations can be added to the undo stack
* @param edits The edit operations to perform
*/
pushEditOperations(edits: ISingleNotebookEditOperation[]): void;
pushEditOperations(edits: INotebookEditOperation[]): void;
getApplicableConnectionProviderIds(kernelName: string): string[];