未验证 提交 08635265 编写于 作者: R Rob Lourens

Fix #34296

上级 e3e9226c
...@@ -195,7 +195,7 @@ export class QueryBuilder { ...@@ -195,7 +195,7 @@ export class QueryBuilder {
const pathPortions = this.expandAbsoluteSearchPaths(pathPortion); const pathPortions = this.expandAbsoluteSearchPaths(pathPortion);
return pathPortions.map(searchPath => { return pathPortions.map(searchPath => {
return <ISearchPathPattern>{ return <ISearchPathPattern>{
searchPath: uri.file(searchPath), searchPath,
pattern: globPortion pattern: globPortion
}; };
}); });
...@@ -207,14 +207,15 @@ export class QueryBuilder { ...@@ -207,14 +207,15 @@ export class QueryBuilder {
/** /**
* Takes a searchPath like `./a/foo` and expands it to absolute paths for all the workspaces it matches. * Takes a searchPath like `./a/foo` and expands it to absolute paths for all the workspaces it matches.
*/ */
private expandAbsoluteSearchPaths(searchPath: string): string[] { private expandAbsoluteSearchPaths(searchPath: string): uri[] {
if (paths.isAbsolute(searchPath)) { if (paths.isAbsolute(searchPath)) {
return [paths.normalize(searchPath)]; // Currently only local resources can be searched for with absolute search paths
return [uri.file(paths.normalize(searchPath))];
} }
if (this.workspaceContextService.getWorkbenchState() === WorkbenchState.FOLDER) { // TODO: @Sandy Try checking workspace folders length instead. if (this.workspaceContextService.getWorkbenchState() === WorkbenchState.FOLDER) { // TODO: @Sandy Try checking workspace folders length instead.
return [paths.normalize( const workspaceUri = this.workspaceContextService.getWorkspace().folders[0].uri;
paths.join(this.workspaceContextService.getWorkspace().folders[0].uri.fsPath, searchPath))]; return [workspaceUri.with({ path: paths.normalize(paths.join(workspaceUri.path, searchPath)) })];
} else if (searchPath === './') { } else if (searchPath === './') {
return []; // ./ or ./**/foo makes sense for single-folder but not multi-folder workspaces return []; // ./ or ./**/foo makes sense for single-folder but not multi-folder workspaces
} else { } else {
...@@ -225,8 +226,8 @@ export class QueryBuilder { ...@@ -225,8 +226,8 @@ export class QueryBuilder {
if (matchingRoots.length) { if (matchingRoots.length) {
return matchingRoots.map(root => { return matchingRoots.map(root => {
return relativeSearchPathMatch[2] ? return relativeSearchPathMatch[2] ?
paths.normalize(paths.join(root.uri.fsPath, relativeSearchPathMatch[2])) : root.uri.with({ path: paths.normalize(paths.join(root.uri.fsPath, relativeSearchPathMatch[2])) }) :
root.uri.fsPath; root.uri;
}); });
} else { } else {
// No root folder with name // No root folder with name
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册