mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-22 01:29:04 +01:00
#57186 - implement previewOptions for findTextInFiles
This commit is contained in:
@@ -511,12 +511,22 @@ suite('workspace-namespace', () => {
|
||||
});
|
||||
|
||||
test('findTextInFiles', async () => {
|
||||
const options: vscode.FindTextInFilesOptions = {
|
||||
include: '*.ts',
|
||||
previewOptions: {
|
||||
leadingChars: 2,
|
||||
maxLines: 1,
|
||||
totalChars: 100
|
||||
}
|
||||
};
|
||||
|
||||
const results: vscode.TextSearchResult[] = [];
|
||||
await vscode.workspace.findTextInFiles({ pattern: 'foo' }, { include: '*.ts' }, result => {
|
||||
await vscode.workspace.findTextInFiles({ pattern: 'foo' }, options, result => {
|
||||
results.push(result);
|
||||
});
|
||||
|
||||
assert.equal(results.length, 1);
|
||||
assert.equal(results[0].preview.text, 'n foo(): void {');
|
||||
assert.equal(vscode.workspace.asRelativePath(results[0].uri), '10linefile.ts');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user