@@ -9,6 +9,17 @@ import { ExCommand } from '../../vimscript/exCommand';
9
9
import { Parser , seq , optWhitespace , whitespace } from 'parsimmon' ;
10
10
import { fileNameParser } from '../../vimscript/parserUtils' ;
11
11
12
+ // Still missing:
13
+ // When a number is put before the command this is used
14
+ // as the maximum number of matches to find. Use
15
+ // ":1vimgrep pattern file" to find only the first.
16
+ // Useful if you only want to check if there is a match
17
+ // and quit quickly when it's found.
18
+
19
+ // Without the 'j' flag Vim jumps to the first match.
20
+ // With 'j' only the quickfix list is updated.
21
+ // With the [!] any changes in the current buffer are
22
+ // abandoned.
12
23
interface IGrepCommandArguments {
13
24
pattern : Pattern ;
14
25
files : string [ ] ;
@@ -20,6 +31,7 @@ export class GrepCommand extends ExCommand {
20
31
public static readonly argParser : Parser < GrepCommand > = optWhitespace . then (
21
32
seq (
22
33
Pattern . parser ( { direction : SearchDirection . Backward , delimiter : ' ' } ) ,
34
+
23
35
fileNameParser . sepBy ( whitespace ) ,
24
36
) . map ( ( [ pattern , files ] ) => new GrepCommand ( { pattern, files } ) ) ,
25
37
) ;
@@ -51,6 +63,7 @@ export class GrepCommand extends ExCommand {
51
63
triggerSearch : true ,
52
64
isRegex : true ,
53
65
} ) ;
66
+ await vscode . commands . executeCommand ( 'search.action.focusSearchList' ) ;
54
67
// TODO: this will always throw an error, since the command returns nothing
55
68
// if (!grepResults) {
56
69
// throw error.VimError.fromCode(error.ErrorCode.PatternNotFound);
0 commit comments