diff --git a/src/vs/workbench/contrib/search/common/queryBuilder.ts b/src/vs/workbench/contrib/search/common/queryBuilder.ts index f4d479fa1f236022cc7476f22855b87936e360b8..e2dbe16e7ebcc3e41112753494e9308d3335691a 100644 --- a/src/vs/workbench/contrib/search/common/queryBuilder.ts +++ b/src/vs/workbench/contrib/search/common/queryBuilder.ts @@ -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 [{