diff --git a/src/vs/editor/contrib/linesOperations/linesOperations.ts b/src/vs/editor/contrib/linesOperations/linesOperations.ts index d6d79bee280b27d968a205aa0df7015ecb17cc8f..da8080dd5649fa7329c97800ad630dd3f1730b56 100644 --- a/src/vs/editor/contrib/linesOperations/linesOperations.ts +++ b/src/vs/editor/contrib/linesOperations/linesOperations.ts @@ -235,8 +235,36 @@ interface IDeleteLinesOperation { positionColumn: number; } -abstract class AbstractRemoveLinesAction extends EditorAction { - _getLinesToRemove(editor: ICodeEditor): IDeleteLinesOperation[] { +class DeleteLinesAction extends EditorAction { + + constructor() { + super({ + id: 'editor.action.deleteLines', + label: nls.localize('lines.delete', "Delete Line"), + alias: 'Delete Line', + precondition: EditorContextKeys.writable, + kbOpts: { + kbExpr: EditorContextKeys.textInputFocus, + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_K + } + }); + } + + public run(accessor: ServicesAccessor, editor: ICodeEditor): void { + + let ops = this._getLinesToRemove(editor); + + // Finally, construct the delete lines commands + let commands: ICommand[] = ops.map((op) => { + return new DeleteLinesCommand(op.startLineNumber, op.endLineNumber, op.positionColumn); + }); + + editor.pushUndoStop(); + editor.executeCommands(this.id, commands); + editor.pushUndoStop(); + } + + private _getLinesToRemove(editor: ICodeEditor): IDeleteLinesOperation[] { // Construct delete operations let operations: IDeleteLinesOperation[] = editor.getSelections().map((s) => { @@ -277,36 +305,6 @@ abstract class AbstractRemoveLinesAction extends EditorAction { } } -class DeleteLinesAction extends AbstractRemoveLinesAction { - - constructor() { - super({ - id: 'editor.action.deleteLines', - label: nls.localize('lines.delete', "Delete Line"), - alias: 'Delete Line', - precondition: EditorContextKeys.writable, - kbOpts: { - kbExpr: EditorContextKeys.textInputFocus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_K - } - }); - } - - public run(accessor: ServicesAccessor, editor: ICodeEditor): void { - - let ops = this._getLinesToRemove(editor); - - // Finally, construct the delete lines commands - let commands: ICommand[] = ops.map((op) => { - return new DeleteLinesCommand(op.startLineNumber, op.endLineNumber, op.positionColumn); - }); - - editor.pushUndoStop(); - editor.executeCommands(this.id, commands); - editor.pushUndoStop(); - } -} - export class IndentLinesAction extends EditorAction { constructor() { super({