Skip to content

Commit 30aa374

Browse files
committed
Remove some unnecessary async
1 parent e219ee0 commit 30aa374

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/actions/commands/commandLine.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class CommandlineHome extends CommandLineAction {
216216
keys = [['<Home>'], ['<C-b>']];
217217

218218
protected override async run(vimState: VimState, commandLine: CommandLine): Promise<void> {
219-
await commandLine.home();
219+
commandLine.home();
220220
}
221221
}
222222

@@ -225,7 +225,7 @@ class CommandLineEnd extends CommandLineAction {
225225
keys = [['<End>'], ['<C-e>']];
226226

227227
protected override async run(vimState: VimState, commandLine: CommandLine): Promise<void> {
228-
await commandLine.end();
228+
commandLine.end();
229229
}
230230
}
231231

@@ -234,7 +234,7 @@ class CommandLineDeleteWord extends CommandLineAction {
234234
keys = [['<C-w>'], ['<C-BS>']];
235235

236236
protected override async run(vimState: VimState, commandLine: CommandLine): Promise<void> {
237-
await commandLine.deleteWord();
237+
commandLine.deleteWord();
238238
}
239239
}
240240

@@ -243,7 +243,7 @@ class CommandLineDeleteToBeginning extends CommandLineAction {
243243
keys = ['<C-u>'];
244244

245245
protected override async run(vimState: VimState, commandLine: CommandLine): Promise<void> {
246-
await commandLine.deleteToBeginning();
246+
commandLine.deleteToBeginning();
247247
}
248248
}
249249

@@ -252,7 +252,7 @@ class CommandLineWordLeft extends CommandLineAction {
252252
keys = ['<C-left>'];
253253

254254
protected async run(vimState: VimState, commandLine: CommandLine): Promise<void> {
255-
await commandLine.wordLeft();
255+
commandLine.wordLeft();
256256
}
257257
}
258258

@@ -261,7 +261,7 @@ class CommandLineWordRight extends CommandLineAction {
261261
keys = ['<C-right>'];
262262

263263
protected async run(vimState: VimState, commandLine: CommandLine): Promise<void> {
264-
await commandLine.wordRight();
264+
commandLine.wordRight();
265265
}
266266
}
267267

@@ -270,7 +270,7 @@ class CommandLineHistoryBack extends CommandLineAction {
270270
keys = [['<up>'], ['<C-p>']];
271271

272272
protected async run(vimState: VimState, commandLine: CommandLine): Promise<void> {
273-
await commandLine.historyBack();
273+
commandLine.historyBack();
274274
}
275275
}
276276

@@ -279,7 +279,7 @@ class CommandLineHistoryForward extends CommandLineAction {
279279
keys = [['<down>'], ['<C-n>']];
280280

281281
protected async run(vimState: VimState, commandLine: CommandLine): Promise<void> {
282-
await commandLine.historyForward();
282+
commandLine.historyForward();
283283
}
284284
}
285285

@@ -424,6 +424,6 @@ class CommandLineType extends CommandLineAction {
424424
keys = [['<character>']];
425425

426426
protected async run(vimState: VimState, commandLine: CommandLine): Promise<void> {
427-
void commandLine.typeCharacter(this.keysPressed[0]);
427+
commandLine.typeCharacter(this.keysPressed[0]);
428428
}
429429
}

src/cmd_line/commandLine.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export abstract class CommandLine {
7171
*/
7272
public abstract ctrlF(vimState: VimState): Promise<void>;
7373

74-
public async historyBack(): Promise<void> {
74+
public historyBack(): void {
7575
if (this.historyIndex === 0) {
7676
return;
7777
}
@@ -88,7 +88,7 @@ export abstract class CommandLine {
8888
this.cursorIndex = this.text.length;
8989
}
9090

91-
public async historyForward(): Promise<void> {
91+
public historyForward(): void {
9292
if (this.historyIndex === undefined) {
9393
return;
9494
}
@@ -134,36 +134,36 @@ export abstract class CommandLine {
134134
/**
135135
* Called when `<Home>` is pressed
136136
*/
137-
public async home(): Promise<void> {
137+
public home(): void {
138138
this.cursorIndex = 0;
139139
}
140140

141141
/**
142142
* Called when `<End>` is pressed
143143
*/
144-
public async end(): Promise<void> {
144+
public end(): void {
145145
this.cursorIndex = this.text.length;
146146
}
147147

148148
/**
149149
* Called when `<C-Left>` is pressed
150150
*/
151-
public async wordLeft(): Promise<void> {
151+
public wordLeft(): void {
152152
this.cursorIndex = getWordLeftInText(this.text, this.cursorIndex, WordType.Big) ?? 0;
153153
}
154154

155155
/**
156156
* Called when `<C-Right>` is pressed
157157
*/
158-
public async wordRight(): Promise<void> {
158+
public wordRight(): void {
159159
this.cursorIndex =
160160
getWordRightInText(this.text, this.cursorIndex, WordType.Big) ?? this.text.length;
161161
}
162162

163163
/**
164164
* Called when `<C-BS>` is pressed
165165
*/
166-
public async deleteWord(): Promise<void> {
166+
public deleteWord(): void {
167167
const wordStart = getWordLeftInText(this.text, this.cursorIndex, WordType.Normal);
168168
if (wordStart !== undefined) {
169169
this.text = this.text.substring(0, wordStart).concat(this.text.slice(this.cursorIndex));
@@ -174,12 +174,12 @@ export abstract class CommandLine {
174174
/**
175175
* Called when `<C-BS>` is pressed
176176
*/
177-
public async deleteToBeginning(): Promise<void> {
177+
public deleteToBeginning(): void {
178178
this.text = this.text.slice(this.cursorIndex);
179179
this.cursorIndex = 0;
180180
}
181181

182-
public async typeCharacter(char: string): Promise<void> {
182+
public typeCharacter(char: string): void {
183183
const modifiedString = this.text.split('');
184184
modifiedString.splice(this.cursorIndex, 0, char);
185185
this.text = modifiedString.join('');

0 commit comments

Comments
 (0)