Skip to content

Commit

Permalink
Fix #23534 - no reason to force --regexp when using --word-regex
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Mar 29, 2017
1 parent 68e6886 commit 2a82321
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/vs/workbench/services/search/node/ripgrepTextSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { rgPath } from 'vscode-ripgrep';

import * as extfs from 'vs/base/node/extfs';
import * as encoding from 'vs/base/node/encoding';
import * as strings from 'vs/base/common/strings';
import * as glob from 'vs/base/common/glob';
import { ILineMatch, IProgress } from 'vs/platform/search/common/search';
import { TPromise } from 'vs/base/common/winjs.base';
Expand Down Expand Up @@ -366,20 +365,16 @@ function getRgArgs(config: IRawSearch): { args: string[], siblingClauses: glob.I
args.push('--encoding', encoding.toCanonicalName(config.fileEncoding));
}

if (config.contentPattern.isWordMatch) {
args.push('--word-regexp');
}

let searchPatternAfterDoubleDashes: string;
if (config.contentPattern.isRegExp) {
if (config.contentPattern.isWordMatch) {
args.push('--word-regexp');
}

args.push('--regexp', config.contentPattern.pattern);
} else {
if (config.contentPattern.isWordMatch) {
args.push('--word-regexp', '--regexp', strings.escapeRegExpCharacters(config.contentPattern.pattern));
} else {
args.push('--fixed-strings');
searchPatternAfterDoubleDashes = config.contentPattern.pattern;
}
searchPatternAfterDoubleDashes = config.contentPattern.pattern;
args.push('--fixed-strings');
}

// Folder to search
Expand Down

0 comments on commit 2a82321

Please sign in to comment.