Merge from vscode 52dcb723a39ae75bee1bd56b3312d7fcdc87aeed (#6719)

This commit is contained in:
Anthony Dresser
2019-08-12 21:31:51 -07:00
committed by GitHub
parent 00250839fc
commit 7eba8c4c03
616 changed files with 9472 additions and 7087 deletions

View File

@@ -14,13 +14,17 @@ export class CopyLinesCommand implements editorCommon.ICommand {
private readonly _isCopyingDown: boolean;
private _selectionDirection: SelectionDirection;
private _selectionId: string;
private _selectionId: string | null;
private _startLineNumberDelta: number;
private _endLineNumberDelta: number;
constructor(selection: Selection, isCopyingDown: boolean) {
this._selection = selection;
this._isCopyingDown = isCopyingDown;
this._selectionDirection = SelectionDirection.LTR;
this._selectionId = null;
this._startLineNumberDelta = 0;
this._endLineNumberDelta = 0;
}
public getEditOperations(model: ITextModel, builder: editorCommon.IEditOperationBuilder): void {
@@ -58,7 +62,7 @@ export class CopyLinesCommand implements editorCommon.ICommand {
}
public computeCursorState(model: ITextModel, helper: editorCommon.ICursorStateComputerData): Selection {
let result = helper.getTrackedSelection(this._selectionId);
let result = helper.getTrackedSelection(this._selectionId!);
if (this._startLineNumberDelta !== 0 || this._endLineNumberDelta !== 0) {
let startLineNumber = result.startLineNumber;

View File

@@ -20,7 +20,7 @@ export class MoveLinesCommand implements ICommand {
private readonly _isMovingDown: boolean;
private readonly _autoIndent: boolean;
private _selectionId: string;
private _selectionId: string | null;
private _moveEndPositionDown?: boolean;
private _moveEndLineSelectionShrink: boolean;
@@ -28,6 +28,7 @@ export class MoveLinesCommand implements ICommand {
this._selection = selection;
this._isMovingDown = isMovingDown;
this._autoIndent = autoIndent;
this._selectionId = null;
this._moveEndLineSelectionShrink = false;
}
@@ -36,9 +37,11 @@ export class MoveLinesCommand implements ICommand {
let modelLineCount = model.getLineCount();
if (this._isMovingDown && this._selection.endLineNumber === modelLineCount) {
this._selectionId = builder.trackSelection(this._selection);
return;
}
if (!this._isMovingDown && this._selection.startLineNumber === 1) {
this._selectionId = builder.trackSelection(this._selection);
return;
}
@@ -328,7 +331,7 @@ export class MoveLinesCommand implements ICommand {
}
public computeCursorState(model: ITextModel, helper: ICursorStateComputerData): Selection {
let result = helper.getTrackedSelection(this._selectionId);
let result = helper.getTrackedSelection(this._selectionId!);
if (this._moveEndPositionDown) {
result = result.setEndPosition(result.endLineNumber + 1, 1);

View File

@@ -12,12 +12,13 @@ import { IIdentifiedSingleEditOperation, ITextModel } from 'vs/editor/common/mod
export class SortLinesCommand implements editorCommon.ICommand {
private readonly selection: Selection;
private selectionId: string;
private readonly descending: boolean;
private selectionId: string | null;
constructor(selection: Selection, descending: boolean) {
this.selection = selection;
this.descending = descending;
this.selectionId = null;
}
public getEditOperations(model: ITextModel, builder: editorCommon.IEditOperationBuilder): void {
@@ -30,7 +31,7 @@ export class SortLinesCommand implements editorCommon.ICommand {
}
public computeCursorState(model: ITextModel, helper: editorCommon.ICursorStateComputerData): Selection {
return helper.getTrackedSelection(this.selectionId);
return helper.getTrackedSelection(this.selectionId!);
}
public static canRun(model: ITextModel | null, selection: Selection, descending: boolean): boolean {