mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-19 08:08:39 +01:00
Fix range when copying empty selection (#182227)
This fixes the range extensions get when copying an empty selection. As part of this, I've also: - Added tests for this change - Made the paste parts of the api optional. This is useful when a test provider only wants to add data on copy
This commit is contained in:
@@ -62,6 +62,17 @@ export function disposeAll(disposables: vscode.Disposable[]) {
|
||||
vscode.Disposable.from(...disposables).dispose();
|
||||
}
|
||||
|
||||
export function usingDisposables<R>(fn: (this: Mocha.Context, store: vscode.Disposable[]) => Promise<R>) {
|
||||
return async function (this: Mocha.Context): Promise<R> {
|
||||
const disposables: vscode.Disposable[] = [];
|
||||
try {
|
||||
return await fn.call(this, disposables);
|
||||
} finally {
|
||||
disposeAll(disposables);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function delay(ms: number) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user