mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
105 lines
3.9 KiB
TypeScript
105 lines
3.9 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
declare module 'vscode' {
|
|
|
|
// https://github.com/microsoft/vscode/issues/59924
|
|
|
|
/**
|
|
* Options that can be set on a findTextInFiles search.
|
|
*/
|
|
export interface FindTextInFilesOptions {
|
|
/**
|
|
* A {@link GlobPattern glob pattern} that defines the files to search for. The glob pattern
|
|
* will be matched against the file paths of files relative to their workspace. Use a {@link RelativePattern relative pattern}
|
|
* to restrict the search results to a {@link WorkspaceFolder workspace folder}.
|
|
*/
|
|
include?: GlobPattern;
|
|
|
|
/**
|
|
* A {@link GlobPattern glob pattern} that defines files and folders to exclude. The glob pattern
|
|
* will be matched against the file paths of resulting matches relative to their workspace. When `undefined`, default excludes will
|
|
* apply.
|
|
*/
|
|
exclude?: GlobPattern;
|
|
|
|
/**
|
|
* Whether to use the default and user-configured excludes. Defaults to true.
|
|
*/
|
|
useDefaultExcludes?: boolean;
|
|
|
|
/**
|
|
* The maximum number of results to search for
|
|
*/
|
|
maxResults?: number;
|
|
|
|
/**
|
|
* Whether external files that exclude files, like .gitignore, should be respected.
|
|
* See the vscode setting `"search.useIgnoreFiles"`.
|
|
*/
|
|
useIgnoreFiles?: boolean;
|
|
|
|
/**
|
|
* Whether global files that exclude files, like .gitignore, should be respected.
|
|
* See the vscode setting `"search.useGlobalIgnoreFiles"`.
|
|
*/
|
|
useGlobalIgnoreFiles?: boolean;
|
|
|
|
/**
|
|
* Whether files in parent directories that exclude files, like .gitignore, should be respected.
|
|
* See the vscode setting `"search.useParentIgnoreFiles"`.
|
|
*/
|
|
useParentIgnoreFiles?: boolean;
|
|
|
|
/**
|
|
* Whether symlinks should be followed while searching.
|
|
* See the vscode setting `"search.followSymlinks"`.
|
|
*/
|
|
followSymlinks?: boolean;
|
|
|
|
/**
|
|
* Interpret files using this encoding.
|
|
* See the vscode setting `"files.encoding"`
|
|
*/
|
|
encoding?: string;
|
|
|
|
/**
|
|
* Options to specify the size of the result text preview.
|
|
*/
|
|
previewOptions?: TextSearchPreviewOptions;
|
|
|
|
/**
|
|
* Number of lines of context to include before each match.
|
|
*/
|
|
beforeContext?: number;
|
|
|
|
/**
|
|
* Number of lines of context to include after each match.
|
|
*/
|
|
afterContext?: number;
|
|
}
|
|
|
|
export namespace workspace {
|
|
/**
|
|
* Search text in files across all {@link workspace.workspaceFolders workspace folders} in the workspace.
|
|
* @param query The query parameters for the search - the search string, whether it's case-sensitive, or a regex, or matches whole words.
|
|
* @param callback A callback, called for each result
|
|
* @param token A token that can be used to signal cancellation to the underlying search engine.
|
|
* @return A thenable that resolves when the search is complete.
|
|
*/
|
|
export function findTextInFiles(query: TextSearchQuery, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<TextSearchComplete>;
|
|
|
|
/**
|
|
* Search text in files across all {@link workspace.workspaceFolders workspace folders} in the workspace.
|
|
* @param query The query parameters for the search - the search string, whether it's case-sensitive, or a regex, or matches whole words.
|
|
* @param options An optional set of query options. Include and exclude patterns, maxResults, etc.
|
|
* @param callback A callback, called for each result
|
|
* @param token A token that can be used to signal cancellation to the underlying search engine.
|
|
* @return A thenable that resolves when the search is complete.
|
|
*/
|
|
export function findTextInFiles(query: TextSearchQuery, options: FindTextInFilesOptions, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<TextSearchComplete>;
|
|
}
|
|
}
|