提交 5fc60ec6 编写于 作者: R Rob Lourens

Fix #63015

上级 c95cd6ca
......@@ -174,7 +174,7 @@ export class QueryBuilder {
*
* Public for test.
*/
public parseSearchPaths(pattern: string): ISearchPathsResult {
public parseSearchPaths(pattern: string, expandSearchPaths = true): ISearchPathsResult {
const isSearchPath = (segment: string) => {
// A segment is a search path if it is an absolute path or starts with ./, ../, .\, or ..\
return paths.isAbsolute(segment) || /^\.\.?[\/\\]/.test(segment);
......@@ -196,9 +196,15 @@ export class QueryBuilder {
const exprSegments = arrays.flatten(expandedExprSegments);
const result: ISearchPathsResult = {};
const searchPaths = this.expandSearchPathPatterns(groups.searchPaths);
if (searchPaths && searchPaths.length) {
result.searchPaths = searchPaths;
if (expandSearchPaths) {
const searchPaths = this.expandSearchPathPatterns(groups.searchPaths);
if (searchPaths && searchPaths.length) {
result.searchPaths = searchPaths;
}
} else if (groups.searchPaths) {
exprSegments.push(...groups.searchPaths
.map(p => strings.ltrim(p, './'))
.map(p => strings.ltrim(p, '.\\')));
}
const includePattern = patternListToIExpression(exprSegments);
......@@ -214,7 +220,7 @@ export class QueryBuilder {
* but the result is a single IExpression that encapsulates all the exclude patterns.
*/
public parseExcludePattern(pattern: string): glob.IExpression | undefined {
const result = this.parseSearchPaths(pattern);
const result = this.parseSearchPaths(pattern, false);
let excludeExpression = glob.getEmptyExpression();
if (result.pattern) {
excludeExpression = objects.mixin(excludeExpression, result.pattern);
......
......@@ -257,7 +257,7 @@ suite('QueryBuilder', () => {
folderQueries: [{
folder: ROOT_1_URI
}],
excludePattern: patternsToIExpression(fixPath(paths.join(ROOT_1, 'bar'))),
excludePattern: patternsToIExpression('bar'),
type: QueryType.Text
});
......@@ -272,7 +272,7 @@ suite('QueryBuilder', () => {
folderQueries: [{
folder: ROOT_1_URI
}],
excludePattern: patternsToIExpression(fixPath(paths.join(ROOT_1, 'bar/**/*.ts'))),
excludePattern: patternsToIExpression('bar/**/*.ts'),
type: QueryType.Text
});
......@@ -287,7 +287,7 @@ suite('QueryBuilder', () => {
folderQueries: [{
folder: ROOT_1_URI
}],
excludePattern: patternsToIExpression(fixPath(paths.join(ROOT_1, 'bar/**/*.ts'))),
excludePattern: patternsToIExpression('bar/**/*.ts'),
type: QueryType.Text
});
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册