Adds paging support to repo/file history quick picks (wip)

This commit is contained in:
Eric Amodio
2017-03-11 15:58:21 -05:00
parent a2a3f1a81e
commit 7aefd178c2
11 changed files with 100 additions and 30 deletions

View File

@@ -1,12 +1,38 @@
'use strict';
import { commands, QuickPickItem, TextEditor, Uri, workspace } from 'vscode';
import { CancellationTokenSource, commands, QuickPickItem, QuickPickOptions, TextEditor, Uri, window, workspace } from 'vscode';
import { Commands, openEditor } from '../commands';
import { IAdvancedConfig } from '../configuration';
import { Logger } from '../logger';
export function getQuickPickIgnoreFocusOut() {
return !workspace.getConfiguration('gitlens').get<IAdvancedConfig>('advanced').quickPick.closeOnFocusOut;
}
export function showQuickPickProgress(message: string): CancellationTokenSource {
const cancellation = new CancellationTokenSource();
_showQuickPickProgress(message, cancellation);
return cancellation;
}
async function _showQuickPickProgress(message: string, cancellation: CancellationTokenSource) {
Logger.log(`showQuickPickProgress`, `show`, message);
await window.showQuickPick(_getInfiniteCancellablePromise(cancellation), {
placeHolder: message,
ignoreFocusOut: getQuickPickIgnoreFocusOut()
} as QuickPickOptions, cancellation.token);
Logger.log(`showQuickPickProgress`, `cancel`, message);
cancellation.cancel();
}
function _getInfiniteCancellablePromise(cancellation: CancellationTokenSource) {
return new Promise((resolve, reject) => {
const disposable = cancellation.token.onCancellationRequested(() => {
disposable.dispose();
reject();
});
});
}
export class CommandQuickPickItem implements QuickPickItem {
label: string;