search.ts 1.6 KB
Newer Older
J
Joao Moreno 已提交
1 2 3 4 5 6 7 8 9
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

'use strict';

import { PPromise } from 'vs/base/common/winjs.base';
import glob = require('vs/base/common/glob');
C
chrmarti 已提交
10
import { IProgress, ILineMatch, IPatternInfo, ISearchStats } from 'vs/platform/search/common/search';
J
Joao Moreno 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

export interface IRawSearch {
	rootFolders: string[];
	extraFiles?: string[];
	filePattern?: string;
	excludePattern?: glob.IExpression;
	includePattern?: glob.IExpression;
	contentPattern?: IPatternInfo;
	maxResults?: number;
	maxFilesize?: number;
	fileEncoding?: string;
}

export interface IRawSearchService {
	fileSearch(search: IRawSearch): PPromise<ISerializedSearchComplete, ISerializedSearchProgressItem>;
	textSearch(search: IRawSearch): PPromise<ISerializedSearchComplete, ISerializedSearchProgressItem>;
}

export interface ISearchEngine {
C
chrmarti 已提交
30
	search: (onResult: (match: ISerializedFileMatch) => void, onProgress: (progress: IProgress) => void, done: (error: Error, complete: ISerializedSearchComplete) => void) => void;
J
Joao Moreno 已提交
31 32 33 34 35
	cancel: () => void;
}

export interface ISerializedSearchComplete {
	limitHit: boolean;
C
chrmarti 已提交
36
	stats: ISearchStats;
J
Joao Moreno 已提交
37 38 39 40 41 42 43
}

export interface ISerializedFileMatch {
	path?: string;
	lineMatches?: ILineMatch[];
}

C
chrmarti 已提交
44 45
// Type of the possible values for progress calls from the engine
export type ISerializedSearchProgressItem = ISerializedFileMatch | ISerializedFileMatch[] | IProgress;