Skip to content

Commit

Permalink
Misc async fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xconverge committed Jan 24, 2019
1 parent b98f94b commit 61cba7a
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export async function activate(context: vscode.ExtensionContext) {

// Delete modehandler once all tabs of this document have been closed
for (let editorIdentity of ModeHandlerMap.getKeys()) {
let modeHandler = await ModeHandlerMap.get(editorIdentity);
const modeHandler = ModeHandlerMap.get(editorIdentity);

if (
modeHandler == null ||
Expand Down
26 changes: 12 additions & 14 deletions src/actions/commands/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ export class PutCommand extends BaseCommand {
});
return vimState;
} else if (typeof register.text === 'object' && vimState.currentMode === ModeName.VisualBlock) {
return await this.execVisualBlockPaste(register.text, position, vimState, after);
return this.execVisualBlockPaste(register.text, position, vimState, after);
}

let text = await PutCommand.GetText(vimState, this.multicursorIndex);
Expand Down Expand Up @@ -1478,9 +1478,7 @@ export class PutCommand extends BaseCommand {
} else {
if (text.indexOf('\n') === -1) {
if (!position.isLineEnd()) {
if (
register.registerMode === RegisterMode.BlockWise
) {
if (register.registerMode === RegisterMode.BlockWise) {
if (after) {
diff = new PositionDiff(0, -1 * text.length);
} else {
Expand Down Expand Up @@ -1646,7 +1644,7 @@ export class PutWithIndentCommand extends BaseCommand {
}

public async execCount(position: Position, vimState: VimState): Promise<VimState> {
return await super.execCount(position, vimState);
return super.execCount(position, vimState);
}
}

Expand Down Expand Up @@ -2332,7 +2330,7 @@ class CommandDeleteToLineEnd extends BaseCommand {
return vimState;
}

return await new operator.DeleteOperator(this.multicursorIndex).run(
return new operator.DeleteOperator(this.multicursorIndex).run(
vimState,
position,
position.getLineEnd().getLeft()
Expand All @@ -2352,7 +2350,7 @@ export class CommandYankFullLine extends BaseCommand {

vimState.currentRegisterMode = RegisterMode.LineWise;

return await new operator.YankOperator().run(vimState, start, end);
return new operator.YankOperator().run(vimState, start, end);
}
}

Expand Down Expand Up @@ -2508,7 +2506,7 @@ class CommandSelectNextLastSearchWord extends BaseCommand {
keys = ['g', 'n'];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
return await selectLastSearchWord(vimState, SearchDirection.Forward);
return selectLastSearchWord(vimState, SearchDirection.Forward);
}
}

Expand All @@ -2518,7 +2516,7 @@ class CommandSelectPreviousLastSearchWord extends BaseCommand {
keys = ['g', 'N'];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
return await selectLastSearchWord(vimState, SearchDirection.Backward);
return selectLastSearchWord(vimState, SearchDirection.Backward);
}
}

Expand Down Expand Up @@ -3144,7 +3142,7 @@ class ActionDeleteCharWithDeleteKey extends BaseCommand {
this.isCompleteAction = false;
return vimState;
}
return await new ActionDeleteChar().execCount(position, vimState);
return new ActionDeleteChar().execCount(position, vimState);
}
}

Expand Down Expand Up @@ -3905,13 +3903,13 @@ class ActionDeleteLineVisualMode extends BaseCommand {

public async exec(position: Position, vimState: VimState): Promise<VimState> {
if (vimState.currentMode === ModeName.Visual) {
return await new operator.DeleteOperator(this.multicursorIndex).run(
return new operator.DeleteOperator(this.multicursorIndex).run(
vimState,
vimState.cursorStartPosition.getLineBegin(),
vimState.cursorPosition.getLineEnd()
);
} else {
return await new operator.DeleteOperator(this.multicursorIndex).run(
return new operator.DeleteOperator(this.multicursorIndex).run(
vimState,
position.getLineBegin(),
position.getLineEnd()
Expand All @@ -3926,7 +3924,7 @@ class ActionChangeLineVisualMode extends BaseCommand {
keys = ['C'];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
return await new operator.DeleteOperator(this.multicursorIndex).run(
return new operator.DeleteOperator(this.multicursorIndex).run(
vimState,
vimState.cursorStartPosition.getLineBegin(),
vimState.cursorPosition.getLineEndIncludingEOL()
Expand All @@ -3940,7 +3938,7 @@ class ActionRemoveLineVisualMode extends BaseCommand {
keys = ['R'];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
return await new operator.DeleteOperator(this.multicursorIndex).run(
return new operator.DeleteOperator(this.multicursorIndex).run(
vimState,
vimState.cursorStartPosition.getLineBegin(),
vimState.cursorPosition.getLineEndIncludingEOL()
Expand Down
2 changes: 1 addition & 1 deletion src/actions/commands/insert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ export class CommandOneNormalCommandInInsertMode extends BaseCommand {

public async exec(position: Position, vimState: VimState): Promise<VimState> {
vimState.returnToInsertAfterCommand = true;
return await new CommandEscInsertMode().exec(position, vimState);
return new CommandEscInsertMode().exec(position, vimState);
}
}
@RegisterAction
Expand Down
10 changes: 5 additions & 5 deletions src/actions/motion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export abstract class BaseMovement extends BaseAction {
position: Position,
vimState: VimState
): Promise<Position | IMovement> {
return await this.execAction(position, vimState);
return this.execAction(position, vimState);
}

/**
Expand Down Expand Up @@ -783,7 +783,7 @@ class MoveRepeat extends BaseMovement {
): Promise<Position | IMovement> {
const movement = VimState.lastSemicolonRepeatableMovement;
if (movement) {
return await movement.execActionWithCount(position, vimState, count);
return movement.execActionWithCount(position, vimState, count);
}
return position;
}
Expand All @@ -800,7 +800,7 @@ class MoveRepeatReversed extends BaseMovement {
): Promise<Position | IMovement> {
const movement = VimState.lastCommaRepeatableMovement;
if (movement) {
return await movement.execActionWithCount(position, vimState, count);
return movement.execActionWithCount(position, vimState, count);
}
return position;
}
Expand Down Expand Up @@ -1038,7 +1038,7 @@ class MoveToLineFromViewPortTop extends MoveByScreenLine {
count: number
): Promise<Position | IMovement> {
this.value = count < 1 ? 1 : count;
return await this.execAction(position, vimState);
return this.execAction(position, vimState);
}
}

Expand All @@ -1056,7 +1056,7 @@ class MoveToLineFromViewPortBottom extends MoveByScreenLine {
count: number
): Promise<Position | IMovement> {
this.value = count < 1 ? 1 : count;
return await this.execAction(position, vimState);
return this.execAction(position, vimState);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/actions/operator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export class DeleteOperatorVisual extends BaseOperator {
// see special case in DeleteOperator.delete()
vimState.currentRegisterMode = RegisterMode.LineWise;

return await new DeleteOperator(this.multicursorIndex).run(vimState, start, end);
return new DeleteOperator(this.multicursorIndex).run(vimState, start, end);
}
}

Expand Down Expand Up @@ -314,7 +314,7 @@ export class ShiftYankOperatorVisual extends BaseOperator {
public async run(vimState: VimState, start: Position, end: Position): Promise<VimState> {
vimState.currentRegisterMode = RegisterMode.LineWise;

return await new YankOperator().run(vimState, start, end);
return new YankOperator().run(vimState, start, end);
}
}

Expand All @@ -324,7 +324,7 @@ export class DeleteOperatorXVisual extends BaseOperator {
public modes = [ModeName.Visual, ModeName.VisualLine];

public async run(vimState: VimState, start: Position, end: Position): Promise<VimState> {
return await new DeleteOperator(this.multicursorIndex).run(vimState, start, end);
return new DeleteOperator(this.multicursorIndex).run(vimState, start, end);
}
}

Expand All @@ -339,7 +339,7 @@ export class ChangeOperatorSVisual extends BaseOperator {
}

public async run(vimState: VimState, start: Position, end: Position): Promise<VimState> {
return await new ChangeOperator().run(vimState, start, end);
return new ChangeOperator().run(vimState, start, end);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/actions/textobject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ abstract class IndentObjectMatch extends TextObjectMovement {
}

public async execActionForOperator(position: Position, vimState: VimState): Promise<IMovement> {
return await this.execAction(position, vimState);
return this.execAction(position, vimState);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/cmd_line/commands/read.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ export class ReadCommand extends node.CommandBase {

async getTextToInsert(): Promise<string> {
if (this.arguments.file && this.arguments.file.length > 0) {
return await this.getTextToInsertFromFile();
return this.getTextToInsertFromFile();
} else if (this.arguments.cmd && this.arguments.cmd.length > 0) {
return await this.getTextToInsertFromCmd();
return this.getTextToInsertFromCmd();
} else {
throw Error('Invalid arguments');
}
Expand Down
4 changes: 2 additions & 2 deletions src/cmd_line/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ export class CommandLine {
}

if (this.range.isEmpty) {
await this.command.execute(vimState);
this.command.execute(vimState);
} else {
await this.command.executeWithRange(vimState, this.range);
this.command.executeWithRange(vimState, this.range);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/register/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ export class Register {
*/
public static async get(vimState: VimState): Promise<IRegisterContent> {
const register = vimState.recordedState.registerName;
return await Register.getByKey(register, vimState);
return Register.getByKey(register, vimState);
}

public static async getByKey(register: string, vimState?: VimState): Promise<IRegisterContent> {
Expand Down
4 changes: 2 additions & 2 deletions src/state/globalState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ export class GlobalState {
}
}

public addNewSearchHistoryItem(searchString: string) {
public async addNewSearchHistoryItem(searchString: string) {
if (GlobalState._searchHistory !== undefined) {
GlobalState._searchHistory.add(searchString);
await GlobalState._searchHistory.add(searchString);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/util/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ export class Clipboard {
}

public static async Paste(): Promise<string> {
return await vscode.env.clipboard.readText();
return vscode.env.clipboard.readText();
}
}
2 changes: 2 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"rules": {
"align": false,
"await-promise": [true, "Thenable"],
"ban": false,
"class-name": true,
"comment-format": [
Expand Down Expand Up @@ -45,6 +46,7 @@
"no-inferrable-types": false,
"no-internal-module": false,
"no-null-keyword": false,
"no-return-await": true,
"no-require-imports": false,
"no-shadowed-variable": true,
"no-string-literal": true,
Expand Down

0 comments on commit 61cba7a

Please sign in to comment.