Skip to content

Commit

Permalink
Add more logging around filePatternsToUse
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbvz committed Dec 20, 2024
1 parent e5f9272 commit d4cda5c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/vs/workbench/api/common/extHostWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
}


findFiles2(filePatterns: vscode.GlobPattern[],
findFiles2(filePatterns: readonly vscode.GlobPattern[],
options: vscode.FindFiles2Options = {},
extensionId: ExtensionIdentifier,
token: vscode.CancellationToken = CancellationToken.None): Promise<vscode.Uri[]> {
Expand All @@ -490,7 +490,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
private async _findFilesImpl(
// the old `findFiles` used `include` to query, but the new `findFiles2` uses `filePattern` to query.
// `filePattern` is the proper way to handle this, since it takes less precedence than the ignore files.
query: { type: 'include'; value: vscode.GlobPattern | undefined } | { type: 'filePatterns'; value: vscode.GlobPattern[] },
query: { readonly type: 'include'; readonly value: vscode.GlobPattern | undefined } | { readonly type: 'filePatterns'; readonly value: readonly vscode.GlobPattern[] },
options: vscode.FindFiles2Options,
token: vscode.CancellationToken
): Promise<vscode.Uri[]> {
Expand All @@ -500,7 +500,8 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac

const filePatternsToUse = query.type === 'include' ? [query.value] : query.value ?? [];
if (!Array.isArray(filePatternsToUse)) {
throw new Error(`Invalid file pattern provided ${filePatternsToUse}`);
console.error('Invalid file pattern provided', filePatternsToUse);
throw new Error(`Invalid file pattern provided ${JSON.stringify(filePatternsToUse)}`);
}

const queryOptions: QueryOptions<IFileQueryBuilderOptions>[] = filePatternsToUse.map(filePattern => {
Expand Down

0 comments on commit d4cda5c

Please sign in to comment.