File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 11import { VimError } from '../../error' ;
2- import { StatusBar } from '../../statusBar' ;
32import * as vscode from 'vscode' ;
43import { VimState } from '../../state/vimState' ;
54import { ExCommand } from '../../vimscript/exCommand' ;
@@ -10,18 +9,17 @@ export class VsCodeCommand extends ExCommand {
109 . then ( all )
1110 . map ( ( command ) => new VsCodeCommand ( command ) ) ;
1211
13- private command ? : string ;
12+ private command : string ;
1413
15- public constructor ( command ? : string ) {
14+ public constructor ( command : string ) {
1615 super ( ) ;
1716 this . command = command ;
17+ if ( ! this . command ) {
18+ throw VimError . ArgumentRequired ( ) ;
19+ }
1820 }
1921
2022 async execute ( vimState : VimState ) : Promise < void > {
21- if ( ! this . command ) {
22- StatusBar . displayError ( vimState , VimError . ArgumentRequired ( ) ) ;
23- return ;
24- }
2523 await vscode . commands . executeCommand ( this . command ) ;
2624 }
2725}
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ import { VimError } from '../../src/error';
4343import { EvalCommand } from '../../src/cmd_line/commands/eval' ;
4444import { EchoCommand } from '../../src/cmd_line/commands/echo' ;
4545import { Expression } from '../../src/vimscript/expression/types' ;
46+ import { VsCodeCommand } from '../../src/cmd_line/commands/vscode' ;
4647
4748function exParseTest ( input : string , parsed : ExCommand ) {
4849 test ( input , ( ) => {
@@ -800,6 +801,14 @@ suite('Ex command parsing', () => {
800801 ) ;
801802 } ) ;
802803
804+ suite ( ':vscode' , ( ) => {
805+ exParseTest (
806+ ':vscode editor.action.commentLine' ,
807+ new VsCodeCommand ( 'editor.action.commentLine' ) ,
808+ ) ;
809+ exParseFails ( ':vscode' , VimError . ArgumentRequired ( ) ) ;
810+ } ) ;
811+
803812 suite ( ':y[ank]' , ( ) => {
804813 exParseTest ( ':y' , new YankCommand ( { register : undefined , count : undefined } ) ) ;
805814 exParseTest ( ':y a' , new YankCommand ( { register : 'a' , count : undefined } ) ) ;
You can’t perform that action at this time.
0 commit comments