Skip to content

Commit 8b0a5d6

Browse files
committed
adds focus on the search window
1 parent fc6aee0 commit 8b0a5d6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/cmd_line/commands/grep.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ import { ExCommand } from '../../vimscript/exCommand';
99
import { Parser, seq, optWhitespace, whitespace } from 'parsimmon';
1010
import { fileNameParser } from '../../vimscript/parserUtils';
1111

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.
1223
interface IGrepCommandArguments {
1324
pattern: Pattern;
1425
files: string[];
@@ -20,6 +31,7 @@ export class GrepCommand extends ExCommand {
2031
public static readonly argParser: Parser<GrepCommand> = optWhitespace.then(
2132
seq(
2233
Pattern.parser({ direction: SearchDirection.Backward, delimiter: ' ' }),
34+
2335
fileNameParser.sepBy(whitespace),
2436
).map(([pattern, files]) => new GrepCommand({ pattern, files })),
2537
);
@@ -51,6 +63,7 @@ export class GrepCommand extends ExCommand {
5163
triggerSearch: true,
5264
isRegex: true,
5365
});
66+
await vscode.commands.executeCommand('search.action.focusSearchList');
5467
// TODO: this will always throw an error, since the command returns nothing
5568
// if (!grepResults) {
5669
// throw error.VimError.fromCode(error.ErrorCode.PatternNotFound);

0 commit comments

Comments
 (0)