mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
format ts and json files
This commit is contained in:
@ -70,7 +70,7 @@
|
||||
"postinstall": "node ./node_modules/vscode/bin/install"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^1.8.5",
|
||||
"typescript": "^2.1.4",
|
||||
"vscode": "^1.0.0",
|
||||
"@types/node": "*"
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
'use strict';
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import {MotionState, Motion} from './motions';
|
||||
import { MotionState, Motion } from './motions';
|
||||
|
||||
export enum Mode {
|
||||
INSERT,
|
||||
@ -20,10 +20,10 @@ export interface ModifierKeys {
|
||||
}
|
||||
|
||||
export class DeleteRegister {
|
||||
public isWholeLine:boolean;
|
||||
public content:string;
|
||||
public isWholeLine: boolean;
|
||||
public content: string;
|
||||
|
||||
constructor(isWholeLine:boolean, content:string) {
|
||||
constructor(isWholeLine: boolean, content: string) {
|
||||
this.isWholeLine = isWholeLine;
|
||||
this.content = content;
|
||||
}
|
||||
@ -33,11 +33,11 @@ export interface IController {
|
||||
motionState: MotionState;
|
||||
|
||||
setMode(mode: Mode): void;
|
||||
setVisual(newVisual:boolean): void;
|
||||
setVisual(newVisual: boolean): void;
|
||||
findMotion(input: string): Motion;
|
||||
isMotionPrefix(input: string): boolean;
|
||||
|
||||
setDeleteRegister(register:DeleteRegister): void;
|
||||
setDeleteRegister(register: DeleteRegister): void;
|
||||
getDeleteRegister(): DeleteRegister;
|
||||
}
|
||||
|
||||
@ -50,4 +50,4 @@ export abstract class AbstractCommandDescriptor {
|
||||
export interface Command {
|
||||
commandId: string,
|
||||
args?: any[]
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,10 +14,10 @@ import {
|
||||
window
|
||||
} from 'vscode';
|
||||
|
||||
import {Words} from './words';
|
||||
import {MotionState, Motion} from './motions';
|
||||
import {Mode, IController, DeleteRegister, Command, ModifierKeys} from './common';
|
||||
import {Mappings} from './mappings';
|
||||
import { Words } from './words';
|
||||
import { MotionState, Motion } from './motions';
|
||||
import { Mode, IController, DeleteRegister, Command, ModifierKeys } from './common';
|
||||
import { Mappings } from './mappings';
|
||||
|
||||
export interface ITypeResult {
|
||||
hasConsumedInput: boolean;
|
||||
@ -35,8 +35,8 @@ export class Controller implements IController {
|
||||
public findMotion(input: string): Motion { return Mappings.findMotion(input); }
|
||||
public isMotionPrefix(input: string): boolean { return Mappings.isMotionPrefix(input); }
|
||||
|
||||
private _deleteRegister:DeleteRegister;
|
||||
public setDeleteRegister(register:DeleteRegister): void { this._deleteRegister = register; }
|
||||
private _deleteRegister: DeleteRegister;
|
||||
public setDeleteRegister(register: DeleteRegister): void { this._deleteRegister = register; }
|
||||
public getDeleteRegister(): DeleteRegister { return this._deleteRegister; }
|
||||
|
||||
constructor() {
|
||||
@ -219,7 +219,7 @@ export class Controller implements IController {
|
||||
|
||||
private _interpretNormalModeInput(editor: TextEditor, modifierKeys: ModifierKeys): Thenable<ITypeResult> {
|
||||
if (this._currentInput.startsWith(':')) {
|
||||
return window.showInputBox({value: 'tabm'}).then((value) => {
|
||||
return window.showInputBox({ value: 'tabm' }).then((value) => {
|
||||
let result = this._findMapping(value || '', editor, modifierKeys);
|
||||
return Promise.resolve(result);
|
||||
});
|
||||
@ -298,7 +298,7 @@ export class Controller implements IController {
|
||||
}
|
||||
}
|
||||
|
||||
function setSelectionAndReveal(editor:TextEditor, anchor:Position, line: number, char: number): void {
|
||||
function setSelectionAndReveal(editor: TextEditor, anchor: Position, line: number, char: number): void {
|
||||
editor.selection = new Selection(anchor, new Position(line, char));
|
||||
revealPosition(editor, line, char);
|
||||
}
|
||||
@ -310,4 +310,4 @@ function setPositionAndReveal(editor: TextEditor, line: number, char: number): v
|
||||
|
||||
function revealPosition(editor: TextEditor, line: number, char: number): void {
|
||||
editor.revealRange(new Range(line, char, line, char), TextEditorRevealType.Default);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,12 +6,12 @@
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
import {Words} from './words';
|
||||
import {MotionState, Motion, Motions} from './motions';
|
||||
import {Operator, Operators} from './operators';
|
||||
import {Mode, IController, ModifierKeys} from './common';
|
||||
import {Mappings} from './mappings';
|
||||
import {Controller} from './controller';
|
||||
import { Words } from './words';
|
||||
import { MotionState, Motion, Motions } from './motions';
|
||||
import { Operator, Operators } from './operators';
|
||||
import { Mode, IController, ModifierKeys } from './common';
|
||||
import { Mappings } from './mappings';
|
||||
import { Controller } from './controller';
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
function registerCommandNice(commandId: string, run: (...args: any[]) => void): void {
|
||||
@ -22,7 +22,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
if (!vscode.window.activeTextEditor) {
|
||||
return;
|
||||
}
|
||||
vimExt.type(key, {ctrl: true});
|
||||
vimExt.type(key, { ctrl: true });
|
||||
});
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ class VimExt {
|
||||
this._ensureState();
|
||||
}
|
||||
|
||||
public type(text: string, modifierKeys: ModifierKeys = {ctrl: false, shifit: false, alt: false}): void {
|
||||
public type(text: string, modifierKeys: ModifierKeys = { ctrl: false, shifit: false, alt: false }): void {
|
||||
this._controller.type(vscode.window.activeTextEditor, text, modifierKeys).then((r) => {
|
||||
if (r.hasConsumedInput) {
|
||||
this._ensureState();
|
||||
|
||||
@ -4,10 +4,10 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import {TextEditor} from 'vscode';
|
||||
import {Motion, Motions} from './motions';
|
||||
import {Operator, Operators} from './operators';
|
||||
import {IController, Command, AbstractCommandDescriptor, ModifierKeys} from './common';
|
||||
import { TextEditor } from 'vscode';
|
||||
import { Motion, Motions } from './motions';
|
||||
import { Operator, Operators } from './operators';
|
||||
import { IController, Command, AbstractCommandDescriptor, ModifierKeys } from './common';
|
||||
|
||||
const CHAR_TO_BINDING: { [char: string]: any; } = {};
|
||||
function defineBinding(char: string, value: any, modifierKeys: ModifierKeys): void {
|
||||
@ -27,7 +27,7 @@ function getOperator(char: string, modifierKeys: ModifierKeys = {}): Operator {
|
||||
};
|
||||
|
||||
function defineCommand(char: string, commandId: string, modifierKeys: ModifierKeys = {}): void {
|
||||
defineBinding(char + '__command__', {commandId : commandId}, modifierKeys);
|
||||
defineBinding(char + '__command__', { commandId: commandId }, modifierKeys);
|
||||
};
|
||||
function getCommand(char: string, modifierKeys: ModifierKeys = {}): Command {
|
||||
return getBinding(char + '__command__', modifierKeys);
|
||||
@ -105,11 +105,11 @@ defineMotionCommand('tabm>>', Motions.MoveActiveEditorLast);
|
||||
defineMotionCommand('tabm.', Motions.MoveActiveEditorCenter);
|
||||
|
||||
// Scroll motions
|
||||
defineMotionCommand('e', Motions.ScrollDownByLine, {ctrl: true});
|
||||
defineMotionCommand('d', Motions.ScrollDownByHalfPage, {ctrl: true});
|
||||
defineMotionCommand('f', Motions.ScrollDownByPage, {ctrl: true});
|
||||
defineMotionCommand('y', Motions.ScrollUpByLine, {ctrl: true});
|
||||
defineMotionCommand('u', Motions.ScrollUpByHalfPage, {ctrl: true});
|
||||
defineMotionCommand('e', Motions.ScrollDownByLine, { ctrl: true });
|
||||
defineMotionCommand('d', Motions.ScrollDownByHalfPage, { ctrl: true });
|
||||
defineMotionCommand('f', Motions.ScrollDownByPage, { ctrl: true });
|
||||
defineMotionCommand('y', Motions.ScrollUpByLine, { ctrl: true });
|
||||
defineMotionCommand('u', Motions.ScrollUpByHalfPage, { ctrl: true });
|
||||
defineMotionCommand('b', Motions.ScrollUpByPage, { ctrl: true });
|
||||
|
||||
defineMotionCommand('zt', Motions.RevealCurrentLineAtTop);
|
||||
@ -122,8 +122,8 @@ defineMotionCommand('zo', Motions.UnfoldUnder);
|
||||
|
||||
|
||||
export interface IFoundOperator {
|
||||
runNormal(controller: IController, editor:TextEditor): boolean;
|
||||
runVisual(controller: IController, editor:TextEditor): boolean;
|
||||
runNormal(controller: IController, editor: TextEditor): boolean;
|
||||
runVisual(controller: IController, editor: TextEditor): boolean;
|
||||
}
|
||||
|
||||
export class Mappings {
|
||||
@ -145,7 +145,7 @@ export class Mappings {
|
||||
let command = Mappings.findMotionCommandFromNumberAndString(parsed, isVisual, modifierKeys);
|
||||
if (!command) {
|
||||
parsed = _parseNumberAndString(input, false);
|
||||
command= Mappings.findMotionCommandFromNumberAndString(parsed, isVisual, modifierKeys);
|
||||
command = Mappings.findMotionCommandFromNumberAndString(parsed, isVisual, modifierKeys);
|
||||
}
|
||||
return command;
|
||||
}
|
||||
@ -164,7 +164,7 @@ export class Mappings {
|
||||
if (!motionCommand) {
|
||||
motionCommand = getMotionCommand(numberAndString.input, modifierKeys);
|
||||
}
|
||||
return motionCommand ? motionCommand.createCommand({ isVisual: isVisual, repeat: numberAndString.hasRepeatCount ? numberAndString.repeatCount : undefined}) : null;
|
||||
return motionCommand ? motionCommand.createCommand({ isVisual: isVisual, repeat: numberAndString.hasRepeatCount ? numberAndString.repeatCount : undefined }) : null;
|
||||
}
|
||||
|
||||
public static findOperator(input: string, modifierKeys: ModifierKeys): IFoundOperator {
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import {Position, TextDocument, window} from 'vscode';
|
||||
import {Words, WordCharacters} from './words';
|
||||
import {Command, AbstractCommandDescriptor} from './common';
|
||||
import { Position, TextDocument, window } from 'vscode';
|
||||
import { Words, WordCharacters } from './words';
|
||||
import { Command, AbstractCommandDescriptor } from './common';
|
||||
|
||||
export class MotionState {
|
||||
|
||||
@ -25,7 +25,7 @@ export class MotionState {
|
||||
export abstract class Motion {
|
||||
public abstract run(doc: TextDocument, pos: Position, state: MotionState): Position;
|
||||
|
||||
public repeat(hasRepeatCount:boolean, count: number): Motion {
|
||||
public repeat(hasRepeatCount: boolean, count: number): Motion {
|
||||
if (!hasRepeatCount) {
|
||||
return this;
|
||||
}
|
||||
@ -192,7 +192,7 @@ class GoToLineUndefinedMotion extends Motion {
|
||||
return pos;
|
||||
}
|
||||
|
||||
public repeat(hasRepeatCount:boolean, count: number): Motion {
|
||||
public repeat(hasRepeatCount: boolean, count: number): Motion {
|
||||
if (!hasRepeatCount) {
|
||||
return Motions.GoToLastLine;
|
||||
}
|
||||
@ -202,7 +202,7 @@ class GoToLineUndefinedMotion extends Motion {
|
||||
|
||||
abstract class GoToLineMotion extends Motion {
|
||||
|
||||
protected firstNonWhitespaceChar(doc: TextDocument, line:number): number {
|
||||
protected firstNonWhitespaceChar(doc: TextDocument, line: number): number {
|
||||
let lineContent = doc.lineAt(line).text;
|
||||
let character = 0;
|
||||
while (character < lineContent.length) {
|
||||
@ -231,9 +231,9 @@ class GoToLastLineMotion extends GoToLineMotion {
|
||||
}
|
||||
|
||||
class GoToLineDefinedMotion extends GoToLineMotion {
|
||||
private _lineNumber:number;
|
||||
private _lineNumber: number;
|
||||
|
||||
constructor(lineNumber:number) {
|
||||
constructor(lineNumber: number) {
|
||||
super();
|
||||
this._lineNumber = lineNumber;
|
||||
}
|
||||
|
||||
@ -4,33 +4,33 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import {Position, Selection, Range, TextDocument, TextEditor, TextEditorRevealType} from 'vscode';
|
||||
import {MotionState, Motion, Motions} from './motions';
|
||||
import {Mode, IController, DeleteRegister} from './common';
|
||||
import { Position, Selection, Range, TextDocument, TextEditor, TextEditorRevealType } from 'vscode';
|
||||
import { MotionState, Motion, Motions } from './motions';
|
||||
import { Mode, IController, DeleteRegister } from './common';
|
||||
|
||||
export abstract class Operator {
|
||||
|
||||
public abstract runNormalMode(ctrl: IController, ed:TextEditor, repeatCount: number, args: string): boolean;
|
||||
public abstract runVisualMode(ctrl: IController, ed:TextEditor, args: string): boolean;
|
||||
public abstract runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, args: string): boolean;
|
||||
public abstract runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean;
|
||||
|
||||
protected doc(ed:TextEditor): TextDocument {
|
||||
protected doc(ed: TextEditor): TextDocument {
|
||||
return ed.document;
|
||||
}
|
||||
|
||||
protected pos(ed:TextEditor): Position {
|
||||
protected pos(ed: TextEditor): Position {
|
||||
return ed.selection.active;
|
||||
}
|
||||
|
||||
protected sel(ed:TextEditor): Selection {
|
||||
protected sel(ed: TextEditor): Selection {
|
||||
return ed.selection;
|
||||
}
|
||||
|
||||
protected setPosReveal(ed:TextEditor, line: number, char: number): void {
|
||||
protected setPosReveal(ed: TextEditor, line: number, char: number): void {
|
||||
ed.selection = new Selection(new Position(line, char), new Position(line, char));
|
||||
ed.revealRange(ed.selection, TextEditorRevealType.Default);
|
||||
}
|
||||
|
||||
protected delete(ctrl:IController, ed:TextEditor, isWholeLine:boolean, range:Range): void {
|
||||
protected delete(ctrl: IController, ed: TextEditor, isWholeLine: boolean, range: Range): void {
|
||||
ctrl.setDeleteRegister(new DeleteRegister(isWholeLine, ed.document.getText(range)));
|
||||
ed.edit((builder) => {
|
||||
builder.delete(range);
|
||||
@ -39,25 +39,25 @@ export abstract class Operator {
|
||||
}
|
||||
|
||||
abstract class OperatorWithNoArgs extends Operator {
|
||||
public runNormalMode(ctrl: IController, ed:TextEditor, repeatCount: number, args: string): boolean {
|
||||
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, args: string): boolean {
|
||||
this._run(ctrl, ed);
|
||||
return true;
|
||||
}
|
||||
public runVisualMode(ctrl: IController, ed:TextEditor, args: string): boolean {
|
||||
public runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean {
|
||||
this._run(ctrl, ed);
|
||||
return true;
|
||||
}
|
||||
protected abstract _run(ctrl: IController, ed:TextEditor): void;
|
||||
protected abstract _run(ctrl: IController, ed: TextEditor): void;
|
||||
}
|
||||
|
||||
class InsertOperator extends OperatorWithNoArgs {
|
||||
protected _run(ctrl: IController, ed:TextEditor): void {
|
||||
protected _run(ctrl: IController, ed: TextEditor): void {
|
||||
ctrl.setMode(Mode.INSERT);
|
||||
}
|
||||
}
|
||||
|
||||
class AppendOperator extends OperatorWithNoArgs {
|
||||
protected _run(ctrl: IController, ed:TextEditor): void {
|
||||
protected _run(ctrl: IController, ed: TextEditor): void {
|
||||
let newPos = Motions.RightMotion.run(this.doc(ed), this.pos(ed), ctrl.motionState);
|
||||
this.setPosReveal(ed, newPos.line, newPos.character);
|
||||
ctrl.setMode(Mode.INSERT);
|
||||
@ -65,7 +65,7 @@ class AppendOperator extends OperatorWithNoArgs {
|
||||
}
|
||||
|
||||
class AppendEndOfLineOperator extends OperatorWithNoArgs {
|
||||
protected _run(ctrl: IController, ed:TextEditor): void {
|
||||
protected _run(ctrl: IController, ed: TextEditor): void {
|
||||
let newPos = Motions.EndOfLine.run(this.doc(ed), this.pos(ed), ctrl.motionState);
|
||||
this.setPosReveal(ed, newPos.line, newPos.character);
|
||||
ctrl.setMode(Mode.INSERT);
|
||||
@ -73,14 +73,14 @@ class AppendEndOfLineOperator extends OperatorWithNoArgs {
|
||||
}
|
||||
|
||||
class VisualOperator extends OperatorWithNoArgs {
|
||||
protected _run(ctrl: IController, ed:TextEditor): void {
|
||||
protected _run(ctrl: IController, ed: TextEditor): void {
|
||||
ctrl.motionState.anchor = this.pos(ed);
|
||||
ctrl.setVisual(true);
|
||||
}
|
||||
}
|
||||
|
||||
class DeleteCharUnderCursorOperator extends Operator {
|
||||
public runNormalMode(ctrl: IController, ed:TextEditor, repeatCount: number, args: string): boolean {
|
||||
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, args: string): boolean {
|
||||
let to = Motions.NextCharacter.repeat(repeatCount > 1, repeatCount).run(this.doc(ed), this.pos(ed), ctrl.motionState);
|
||||
let from = this.pos(ed);
|
||||
|
||||
@ -89,7 +89,7 @@ class DeleteCharUnderCursorOperator extends Operator {
|
||||
return true;
|
||||
}
|
||||
|
||||
public runVisualMode(ctrl: IController, ed:TextEditor, args: string): boolean {
|
||||
public runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean {
|
||||
let sel = this.sel(ed);
|
||||
this.delete(ctrl, ed, false, sel);
|
||||
return true;
|
||||
@ -97,7 +97,7 @@ class DeleteCharUnderCursorOperator extends Operator {
|
||||
}
|
||||
|
||||
class DeleteLineOperator extends Operator {
|
||||
public runNormalMode(ctrl: IController, ed:TextEditor, repeatCount: number, args: string): boolean {
|
||||
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, args: string): boolean {
|
||||
let pos = this.pos(ed);
|
||||
let doc = this.doc(ed);
|
||||
|
||||
@ -123,7 +123,7 @@ class DeleteLineOperator extends Operator {
|
||||
return true;
|
||||
}
|
||||
|
||||
public runVisualMode(ctrl: IController, ed:TextEditor, args: string): boolean {
|
||||
public runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean {
|
||||
let sel = this.sel(ed);
|
||||
this.delete(ctrl, ed, false, sel);
|
||||
return true;
|
||||
@ -131,7 +131,7 @@ class DeleteLineOperator extends Operator {
|
||||
}
|
||||
|
||||
abstract class OperatorWithMotion extends Operator {
|
||||
public runNormalMode(ctrl: IController, ed:TextEditor, repeatCount: number, args: string): boolean {
|
||||
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, args: string): boolean {
|
||||
let motion = ctrl.findMotion(args);
|
||||
if (!motion) {
|
||||
|
||||
@ -147,12 +147,12 @@ abstract class OperatorWithMotion extends Operator {
|
||||
return this._runNormalMode(ctrl, ed, motion.repeat(repeatCount > 1, repeatCount));
|
||||
}
|
||||
|
||||
protected abstract _runNormalMode(ctrl: IController, ed:TextEditor, motion: Motion): boolean;
|
||||
protected abstract _runNormalMode(ctrl: IController, ed: TextEditor, motion: Motion): boolean;
|
||||
}
|
||||
|
||||
class DeleteToOperator extends OperatorWithMotion {
|
||||
|
||||
public runNormalMode(ctrl: IController, ed:TextEditor, repeatCount: number, args: string): boolean {
|
||||
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, args: string): boolean {
|
||||
if (args === 'd') {
|
||||
// dd
|
||||
return Operators.DeleteLine.runNormalMode(ctrl, ed, repeatCount, args);
|
||||
@ -160,7 +160,7 @@ class DeleteToOperator extends OperatorWithMotion {
|
||||
return super.runNormalMode(ctrl, ed, repeatCount, args);
|
||||
}
|
||||
|
||||
protected _runNormalMode(ctrl: IController, ed:TextEditor, motion: Motion): boolean {
|
||||
protected _runNormalMode(ctrl: IController, ed: TextEditor, motion: Motion): boolean {
|
||||
let to = motion.run(this.doc(ed), this.pos(ed), ctrl.motionState);
|
||||
let from = this.pos(ed);
|
||||
|
||||
@ -169,7 +169,7 @@ class DeleteToOperator extends OperatorWithMotion {
|
||||
return true;
|
||||
}
|
||||
|
||||
public runVisualMode(ctrl: IController, ed:TextEditor, args: string): boolean {
|
||||
public runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean {
|
||||
let sel = this.sel(ed);
|
||||
this.delete(ctrl, ed, false, sel);
|
||||
return true;
|
||||
@ -178,7 +178,7 @@ class DeleteToOperator extends OperatorWithMotion {
|
||||
|
||||
class PutOperator extends Operator {
|
||||
|
||||
public runNormalMode(ctrl: IController, ed:TextEditor, repeatCount: number, args: string): boolean {
|
||||
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, args: string): boolean {
|
||||
let register = ctrl.getDeleteRegister();
|
||||
if (!register) {
|
||||
// No delete register - beep!!
|
||||
@ -199,7 +199,7 @@ class PutOperator extends Operator {
|
||||
let insertLine = pos.line + 1;
|
||||
let insertCharacter = 0;
|
||||
|
||||
if (insertLine >= doc.lineCount) {
|
||||
if (insertLine >= doc.lineCount) {
|
||||
// on last line
|
||||
insertLine = doc.lineCount - 1;
|
||||
insertCharacter = doc.lineAt(insertLine).text.length;
|
||||
@ -213,7 +213,7 @@ class PutOperator extends Operator {
|
||||
return true;
|
||||
}
|
||||
|
||||
public runVisualMode(ctrl: IController, ed:TextEditor, args: string): boolean {
|
||||
public runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean {
|
||||
let register = ctrl.getDeleteRegister();
|
||||
if (!register) {
|
||||
// No delete register - beep!!
|
||||
@ -233,7 +233,7 @@ class PutOperator extends Operator {
|
||||
|
||||
class ReplaceOperator extends Operator {
|
||||
|
||||
public runNormalMode(ctrl: IController, ed:TextEditor, repeatCount: number, args: string): boolean {
|
||||
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, args: string): boolean {
|
||||
if (args.length === 0) {
|
||||
// input not ready
|
||||
return false;
|
||||
@ -254,7 +254,7 @@ class ReplaceOperator extends Operator {
|
||||
return true;
|
||||
}
|
||||
|
||||
public runVisualMode(ctrl: IController, ed:TextEditor, args: string): boolean {
|
||||
public runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean {
|
||||
if (args.length === 0) {
|
||||
// input not ready
|
||||
return false;
|
||||
@ -284,12 +284,12 @@ class ReplaceOperator extends Operator {
|
||||
|
||||
class ReplaceModeOperator extends Operator {
|
||||
|
||||
public runNormalMode(ctrl: IController, ed:TextEditor, repeatCount: number, args: string): boolean {
|
||||
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, args: string): boolean {
|
||||
ctrl.setMode(Mode.REPLACE);
|
||||
return true;
|
||||
}
|
||||
|
||||
public runVisualMode(ctrl: IController, ed:TextEditor, args: string): boolean {
|
||||
public runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean {
|
||||
this.delete(ctrl, ed, false, this.sel(ed));
|
||||
ctrl.setMode(Mode.INSERT);
|
||||
return true;
|
||||
@ -299,7 +299,7 @@ class ReplaceModeOperator extends Operator {
|
||||
|
||||
class ChangeOperator extends OperatorWithMotion {
|
||||
|
||||
protected _runNormalMode(ctrl: IController, ed:TextEditor, motion: Motion): boolean {
|
||||
protected _runNormalMode(ctrl: IController, ed: TextEditor, motion: Motion): boolean {
|
||||
let to = motion.run(this.doc(ed), this.pos(ed), ctrl.motionState);
|
||||
let from = this.pos(ed);
|
||||
|
||||
@ -310,7 +310,7 @@ class ChangeOperator extends OperatorWithMotion {
|
||||
return true;
|
||||
}
|
||||
|
||||
public runVisualMode(ctrl: IController, ed:TextEditor, args: string): boolean {
|
||||
public runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean {
|
||||
let sel = this.sel(ed);
|
||||
|
||||
this.delete(ctrl, ed, false, sel);
|
||||
@ -321,7 +321,7 @@ class ChangeOperator extends OperatorWithMotion {
|
||||
}
|
||||
}
|
||||
|
||||
function repeatString(str:string, repeatCount:number): string {
|
||||
function repeatString(str: string, repeatCount: number): string {
|
||||
let result = '';
|
||||
for (let i = 0; i < repeatCount; i++) {
|
||||
result += str;
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import {Position, TextDocument} from 'vscode';
|
||||
import { Position, TextDocument } from 'vscode';
|
||||
|
||||
export enum CharacterClass {
|
||||
REGULAR = 0,
|
||||
|
||||
Reference in New Issue
Block a user