diff --git a/src/vs/workbench/api/node/extHostTypeConverters.ts b/src/vs/workbench/api/node/extHostTypeConverters.ts index ddc7c9ca424cbdcd3920449bef1419263889984f..30ab99b0b4733ed8624f0c5b16bf658ea3782212 100644 --- a/src/vs/workbench/api/node/extHostTypeConverters.ts +++ b/src/vs/workbench/api/node/extHostTypeConverters.ts @@ -19,7 +19,6 @@ import { IPosition } from 'vs/editor/common/core/position'; import { IRange } from 'vs/editor/common/core/range'; import { ISelection } from 'vs/editor/common/core/selection'; import * as htmlContent from 'vs/base/common/htmlContent'; -import { IRelativePattern } from 'vs/base/common/glob'; import * as languageSelector from 'vs/editor/common/modes/languageSelector'; import { WorkspaceEditDto, ResourceTextEditDto, ResourceFileEditDto } from 'vs/workbench/api/node/extHost.protocol'; import { MarkerSeverity, IRelatedInformation, IMarkerData, MarkerTag } from 'vs/platform/markers/common/markers'; @@ -744,7 +743,11 @@ export namespace TextEditorOptions { export namespace GlobPattern { - export function from(pattern: vscode.GlobPattern): string | IRelativePattern { + export function from(pattern: vscode.GlobPattern): string | types.RelativePattern { + if (pattern instanceof types.RelativePattern) { + return pattern; + } + if (typeof pattern === 'string') { return pattern; } diff --git a/src/vs/workbench/api/node/extHostTypes.ts b/src/vs/workbench/api/node/extHostTypes.ts index 4cd8e8051d131f04b00e7c24aa5be2294cca9fbe..063fea102d30b1212eded925c4d0737078063729 100644 --- a/src/vs/workbench/api/node/extHostTypes.ts +++ b/src/vs/workbench/api/node/extHostTypes.ts @@ -1821,6 +1821,8 @@ export enum ConfigurationTarget { export class RelativePattern implements IRelativePattern { base: string; + baseFolder?: URI; + pattern: string; constructor(base: vscode.WorkspaceFolder | string, pattern: string) { @@ -1834,7 +1836,13 @@ export class RelativePattern implements IRelativePattern { throw illegalArgument('pattern'); } - this.base = typeof base === 'string' ? base : base.uri.fsPath; + if (typeof base === 'string') { + this.base = base; + } else { + this.baseFolder = base.uri; + this.base = base.uri.fsPath; + } + this.pattern = pattern; } diff --git a/src/vs/workbench/api/node/extHostWorkspace.ts b/src/vs/workbench/api/node/extHostWorkspace.ts index 0aca78832455f1d2f3d7ec4dc4d5056812e7b44c..9d23d2db98592499c7d9448a0faf66dafbdb0396 100644 --- a/src/vs/workbench/api/node/extHostWorkspace.ts +++ b/src/vs/workbench/api/node/extHostWorkspace.ts @@ -20,7 +20,7 @@ import { ILogService } from 'vs/platform/log/common/log'; import { Severity } from 'vs/platform/notification/common/notification'; import { IQueryOptions, IRawFileMatch2 } from 'vs/platform/search/common/search'; import { Workspace, WorkspaceFolder } from 'vs/platform/workspace/common/workspace'; -import { Range } from 'vs/workbench/api/node/extHostTypes'; +import { Range, RelativePattern } from 'vs/workbench/api/node/extHostTypes'; import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions'; import * as vscode from 'vscode'; import { ExtHostWorkspaceShape, IMainContext, IWorkspaceData, MainContext, MainThreadMessageServiceShape, MainThreadWorkspaceShape } from './extHost.protocol'; @@ -346,7 +346,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape { // --- search --- - findFiles(include: vscode.GlobPattern, exclude: vscode.GlobPattern, maxResults: number, extensionId: string, token: vscode.CancellationToken = CancellationToken.None): Thenable { + findFiles(include: string | RelativePattern, exclude: vscode.GlobPattern, maxResults: number, extensionId: string, token: vscode.CancellationToken = CancellationToken.None): Thenable { this._logService.trace(`extHostWorkspace#findFiles: fileSearch, extension: ${extensionId}, entryPoint: findFiles`); let includePattern: string; @@ -357,6 +357,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape { } else { includePattern = include.pattern; includeFolder = include.base; + // TODO use include.baseFolder; } }