Fix #3420 Analyze in notebook doesn't include text (#3482)

- 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:
Kevin Cunnane
2018-12-06 10:33:32 -08:00
committed by GitHub
parent 4a7cf8d870
commit 71d3ec3616
13 changed files with 527 additions and 103 deletions

View File

@@ -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;
}