Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 (#6381)

* Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973

* disable strict null check
This commit is contained in:
Anthony Dresser
2019-07-15 22:35:46 -07:00
committed by GitHub
parent f720ec642f
commit 0b7e7ddbf9
2406 changed files with 59140 additions and 35464 deletions

View File

@@ -5,7 +5,7 @@
import 'vs/css!./dnd';
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { Disposable } from 'vs/base/common/lifecycle';
import { isMacintosh } from 'vs/base/common/platform';
import { KeyCode } from 'vs/base/common/keyCodes';
import { ICodeEditor, IEditorMouseEvent, IMouseTarget, MouseTargetType } from 'vs/editor/browser/editorBrowser';
@@ -28,12 +28,11 @@ function hasTriggerModifier(e: IKeyboardEvent | IMouseEvent): boolean {
}
}
export class DragAndDropController implements editorCommon.IEditorContribution {
export class DragAndDropController extends Disposable implements editorCommon.IEditorContribution {
private static readonly ID = 'editor.contrib.dragAndDrop';
private readonly _editor: ICodeEditor;
private _toUnhook: IDisposable[];
private _dragSelection: Selection | null;
private _dndDecorationIds: string[];
private _mouseDown: boolean;
@@ -45,15 +44,15 @@ export class DragAndDropController implements editorCommon.IEditorContribution {
}
constructor(editor: ICodeEditor) {
super();
this._editor = editor;
this._toUnhook = [];
this._toUnhook.push(this._editor.onMouseDown((e: IEditorMouseEvent) => this._onEditorMouseDown(e)));
this._toUnhook.push(this._editor.onMouseUp((e: IEditorMouseEvent) => this._onEditorMouseUp(e)));
this._toUnhook.push(this._editor.onMouseDrag((e: IEditorMouseEvent) => this._onEditorMouseDrag(e)));
this._toUnhook.push(this._editor.onMouseDrop((e: IEditorMouseEvent) => this._onEditorMouseDrop(e)));
this._toUnhook.push(this._editor.onKeyDown((e: IKeyboardEvent) => this.onEditorKeyDown(e)));
this._toUnhook.push(this._editor.onKeyUp((e: IKeyboardEvent) => this.onEditorKeyUp(e)));
this._toUnhook.push(this._editor.onDidBlurEditorWidget(() => this.onEditorBlur()));
this._register(this._editor.onMouseDown((e: IEditorMouseEvent) => this._onEditorMouseDown(e)));
this._register(this._editor.onMouseUp((e: IEditorMouseEvent) => this._onEditorMouseUp(e)));
this._register(this._editor.onMouseDrag((e: IEditorMouseEvent) => this._onEditorMouseDrag(e)));
this._register(this._editor.onMouseDrop((e: IEditorMouseEvent) => this._onEditorMouseDrop(e)));
this._register(this._editor.onKeyDown((e: IKeyboardEvent) => this.onEditorKeyDown(e)));
this._register(this._editor.onKeyUp((e: IKeyboardEvent) => this.onEditorKeyUp(e)));
this._register(this._editor.onDidBlurEditorWidget(() => this.onEditorBlur()));
this._dndDecorationIds = [];
this._mouseDown = false;
this._modifierPressed = false;
@@ -228,7 +227,7 @@ export class DragAndDropController implements editorCommon.IEditorContribution {
this._dragSelection = null;
this._mouseDown = false;
this._modifierPressed = false;
this._toUnhook = dispose(this._toUnhook);
super.dispose();
}
}

View File

@@ -91,7 +91,7 @@ export class DragAndDropCommand implements editorCommon.ICommand {
this.selection.endColumn
);
} else {
// The target position is before the selection's end postion. Since the selection doesn't contain the target position, the selection is one-line and target position is before this selection.
// The target position is before the selection's end position. Since the selection doesn't contain the target position, the selection is one-line and target position is before this selection.
this.targetSelection = new Selection(
this.targetPosition.lineNumber - this.selection.endLineNumber + this.selection.startLineNumber,
this.targetPosition.column,