mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -05:00
- Add edit API that can be used in the extension - Separated document and editor classes out since this is the point those get big. I can refactor back in if needed to ease code review - Based this off text editing APIs but tweaked for the fact this is a cell/array based set of edits
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { nb } from 'sqlops';
|
||||
import { TreeItem } from 'vs/workbench/api/node/extHostTypes';
|
||||
|
||||
// SQL added extension host types
|
||||
@@ -457,4 +458,44 @@ export enum FutureMessageType {
|
||||
export interface INotebookFutureDone {
|
||||
succeeded: boolean;
|
||||
rejectReason: string;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ICellRange {
|
||||
readonly start: number;
|
||||
readonly end: number;
|
||||
}
|
||||
|
||||
export class CellRange {
|
||||
|
||||
protected _start: number;
|
||||
protected _end: number;
|
||||
|
||||
get start(): number {
|
||||
return this._start;
|
||||
}
|
||||
|
||||
get end(): number {
|
||||
return this._end;
|
||||
}
|
||||
|
||||
constructor(start: number, end: number) {
|
||||
if (typeof(start) !== 'number' || typeof(start) !== 'number' || start < 0 || end < 0) {
|
||||
throw new Error('Invalid arguments');
|
||||
}
|
||||
|
||||
// Logic taken from range handling.
|
||||
if (start <= end) {
|
||||
this._start = start;
|
||||
this._end = end;
|
||||
} else {
|
||||
this._start = end;
|
||||
this._end = start;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface ISingleNotebookEditOperation {
|
||||
range: ICellRange;
|
||||
cell: Partial<nb.ICellContents>;
|
||||
forceMoveMarkers: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user