From 73db972b9d16f80afdcc1e35d03ea9de9de4a99b Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Sun, 1 Jul 2018 15:15:07 -0700 Subject: [PATCH] findTextInFiles - hook up includes/excludes --- src/vs/workbench/api/node/extHostWorkspace.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/api/node/extHostWorkspace.ts b/src/vs/workbench/api/node/extHostWorkspace.ts index afc18e7968a..f436c69be5b 100644 --- a/src/vs/workbench/api/node/extHostWorkspace.ts +++ b/src/vs/workbench/api/node/extHostWorkspace.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import { posix, relative } from 'path'; +import { posix, relative, join } from 'path'; import { delta as arrayDelta } from 'vs/base/common/arrays'; import { Emitter, Event } from 'vs/base/common/event'; import { TernarySearchTree } from 'vs/base/common/map'; @@ -375,15 +375,22 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape { const requestId = ExtHostWorkspace._requestIdPool++; + const globPatternToString = (pattern: vscode.GlobPattern | string) => { + if (typeof pattern === 'string') { + return pattern; + } + + return join(pattern.base, pattern.pattern); + }; + const queryOptions: IQueryOptions = { ignoreSymlinks: typeof options.followSymlinks === 'boolean' ? !options.followSymlinks : undefined, disregardIgnoreFiles: typeof options.useIgnoreFiles === 'boolean' ? !options.useIgnoreFiles : undefined, fileEncoding: options.encoding, maxResults: options.maxResults, - // TODO - // includePattern: options.includes - // excludePattern: options.excludes + includePattern: options.includes && options.includes.map(include => globPatternToString(include)).join(', '), + excludePattern: options.excludes && options.excludes.map(exclude => globPatternToString(exclude)).join(', ') }; this._activeSearchCallbacks[requestId] = p => { -- GitLab