Fix 'null' exclude for findFiles, add more tests

Fix #77813
This commit is contained in:
Rob Lourens
2019-07-24 14:24:04 -07:00
parent ea1f61356f
commit 70ab0ada55
7 changed files with 33 additions and 5 deletions

View File

@@ -988,8 +988,9 @@ export namespace GlobPattern {
export function from(pattern: vscode.GlobPattern): string | types.RelativePattern;
export function from(pattern: undefined): undefined;
export function from(pattern: vscode.GlobPattern | undefined): string | types.RelativePattern | undefined;
export function from(pattern: vscode.GlobPattern | undefined): string | types.RelativePattern | undefined {
export function from(pattern: null): null;
export function from(pattern: vscode.GlobPattern | undefined | null): string | types.RelativePattern | undefined | null;
export function from(pattern: vscode.GlobPattern | undefined | null): string | types.RelativePattern | undefined | null {
if (pattern instanceof types.RelativePattern) {
return pattern;
}

View File

@@ -408,7 +408,10 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
// --- search ---
findFiles(include: string | RelativePattern | undefined, exclude: vscode.GlobPattern | undefined, maxResults: number | undefined, extensionId: ExtensionIdentifier, token: vscode.CancellationToken = CancellationToken.None): Promise<vscode.Uri[]> {
/**
* Note, null/undefined have different and important meanings for "exclude"
*/
findFiles(include: string | RelativePattern | undefined, exclude: vscode.GlobPattern | null | undefined, maxResults: number | undefined, extensionId: ExtensionIdentifier, token: vscode.CancellationToken = CancellationToken.None): Promise<vscode.Uri[]> {
this._logService.trace(`extHostWorkspace#findFiles: fileSearch, extension: ${extensionId.value}, entryPoint: findFiles`);
let includePattern: string | undefined;