-
Notifications
You must be signed in to change notification settings - Fork 30.2k
/
Copy pathvscode.proposed.findFiles2New.d.ts
105 lines (98 loc) · 4.46 KB
/
vscode.proposed.findFiles2New.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*---------------------------------------------------------------------------------------------
* 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' {
export interface FindFiles2OptionsNew {
/**
* An array of {@link GlobPattern GlobPattern} that defines files to exclude.
* The glob patterns will be matched against the file paths of files relative to their workspace or {@link RelativePattern.baseUri} if applicable.
*
* If more than one value is used, the values are combined with a logical AND.
* For example, consider the following code:
*
* ```ts
* const ab = findFiles(['**/*.js'], {exclude: ['*.ts', '*.js']});
* const a = findFiles(['**/*.js'], {exclude: ['*.ts']});
* const b = findFiles(['**/*.js'], {exclude: ['*.js']});
* ```
*
* In this, `ab` will be the intersection of results from `a` and `b`.
*/
exclude?: GlobPattern[];
/**
* Which settings to follow when searching for files. Defaults to {@link ExcludeSettingOptions.searchAndFilesExclude}.
*/
useExcludeSettings?: ExcludeSettingOptions;
/**
* The maximum number of results to search for. Defaults to 20000 results.
*/
maxResults?: number;
/**
* Which file locations have ignore (`.gitignore` or `.ignore`) files to follow.
*
* When any of these fields are `undefined`, the value will either be assumed (e.g. if only one is valid),
* or it will follow settings based on the corresponding `search.use*IgnoreFiles` setting.
*
* Will log an error if an invalid combination is set.
*
* Although `.ignore` files are uncommon, they can be leveraged if there are patterns
* that should not be known to git, but should be known to the search providers.
* They should be in the same locations where `.gitignore` files are found, and they follow the same format.
*/
useIgnoreFiles?: {
/**
* Use ignore files at the current workspace root.
* May default to `search.useIgnoreFiles` setting if not set.
*/
local?: boolean;
/**
* Use ignore files at the parent directory. When set to `true`, {@link FindFiles2OptionsNew.useIgnoreFiles.local} must also be `true`.
* May default to `search.useParentIgnoreFiles` setting if not set.
*/
parent?: boolean;
/**
* Use global ignore files. When set to `true`, {@link FindFiles2OptionsNew.useIgnoreFiles.local} must also be `true`.
* May default to `search.useGlobalIgnoreFiles` setting if not set.
*/
global?: boolean;
};
/**
* Whether symlinks should be followed while searching.
* Defaults to the value for `search.followSymlinks` in settings.
* For more info, see the setting description for `search.followSymlinks`.
*/
followSymlinks?: boolean;
}
export namespace workspace {
/**
* WARNING: VERY EXPERIMENTAL.
*
* Find files across all {@link workspace.workspaceFolders workspace folders} in the workspace.
*
* @example
* findFiles(['**/*.js'], {exclude: ['**/out/**'], useIgnoreFiles: true, maxResults: 10})
*
* @param filePattern An array of {@link GlobPattern GlobPattern} that defines the files to search for.
* The glob patterns will be matched against the file paths of files relative to their workspace or {@link baseUri GlobPattern.baseUri} if applicable.
* Use a {@link RelativePattern RelativePatten} to restrict the search results to a {@link WorkspaceFolder workspace folder}.
*
* If more than one value is used, the values are combined with a logical OR.
*
* For example, consider the following code:
*
* ```ts
* const ab = findFiles(['*.ts', '*.js']);
* const a = findFiles(['**/*.ts']);
* const b = findFiles(['**/*.js']);
* ```
*
* In this, `ab` will be the union of results from `a` and `b`.
* @param options A set of {@link FindFiles2Options FindFiles2Options} that defines where and how to search (e.g. exclude settings).
* @param token A token that can be used to signal cancellation to the underlying search engine.
* @returns A thenable that resolves to an array of resource identifiers. Will return no results if no
* {@link workspace.workspaceFolders workspace folders} are opened.
*/
export function findFiles2New(filePattern: GlobPattern[], options?: FindFiles2OptionsNew, token?: CancellationToken): Thenable<Uri[]>;
}
}