提交 cfe6d2d8 编写于 作者: R Rob Lourens

More flexible find absolute path

上级 8c0fdc2b
......@@ -18,6 +18,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { getExcludes, ICommonQueryProps, IFileQuery, IFolderQuery, IPatternInfo, ISearchConfiguration, ITextQuery, ITextSearchPreviewOptions, pathIncludedInQuery, QueryType } from 'vs/workbench/services/search/common/search';
import { Schemas } from 'vs/base/common/network';
/**
* One folder to search and a glob expression that should be applied.
......@@ -320,6 +321,13 @@ export class QueryBuilder {
*/
private expandOneSearchPath(searchPath: string): IOneSearchPathPattern[] {
if (path.isAbsolute(searchPath)) {
const workspaceFolders = this.workspaceContextService.getWorkspace().folders;
if (workspaceFolders[0] && workspaceFolders[0].uri.scheme !== Schemas.file) {
return [{
searchPath: workspaceFolders[0].uri.with({ path: searchPath })
}];
}
// Currently only local resources can be searched for with absolute search paths.
// TODO convert this to a workspace folder + pattern, so excludes will be resolved properly for an absolute path inside a workspace folder
return [{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册