mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 10:08:49 +01:00
api - allow to provide a cancellation token to findFiles. Fixes #1553
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import {workspace, TextDocument, window, Position, Uri} from 'vscode';
|
||||
import {workspace, TextDocument, window, Position, Uri, CancellationTokenSource} from 'vscode';
|
||||
import {createRandomFile, deleteFile, cleanUp, pathEquals} from './utils';
|
||||
import {join, basename} from 'path';
|
||||
import * as fs from 'fs';
|
||||
@@ -125,4 +125,15 @@ suite('workspace-namespace', () => {
|
||||
assert.equal(basename(workspace.asRelativePath(res[0])), 'far.js');
|
||||
});
|
||||
});
|
||||
|
||||
test('findFiles, cancellation', () => {
|
||||
|
||||
const source = new CancellationTokenSource();
|
||||
const token = source.token; // just to get an instance first
|
||||
source.cancel();
|
||||
|
||||
return workspace.findFiles('*.js', null, 100, token).then((res) => {
|
||||
assert.equal(res, void 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user