mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-25 18:02:01 -05:00
Fixes issue showing repo history w/ no active editor
This commit is contained in:
@@ -9,8 +9,8 @@ import * as path from 'path';
|
||||
|
||||
export class FileHistoryQuickPick {
|
||||
|
||||
static showProgress(maxCount?: number) {
|
||||
return showQuickPickProgress(`Loading file history \u2014 ${maxCount ? ` limited to ${maxCount} commits` : ` this may take a while`}\u2026`,
|
||||
static showProgress(uri: GitUri) {
|
||||
return showQuickPickProgress(`${uri.getFormattedPath()}${uri.sha ? ` \u00a0\u2022\u00a0 ${uri.sha.substring(0, 8)}` : ''}`,
|
||||
{
|
||||
left: KeyNoopCommand,
|
||||
',': KeyNoopCommand,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'use strict';
|
||||
import { CancellationTokenSource, commands, QuickPickItem, QuickPickOptions, TextEditor, Uri, window, workspace } from 'vscode';
|
||||
import { CancellationTokenSource, commands, Disposable, QuickPickItem, QuickPickOptions, TextEditor, Uri, window, workspace } from 'vscode';
|
||||
import { Commands, Keyboard, KeyboardScope, KeyMapping, openEditor } from '../commands';
|
||||
import { IAdvancedConfig } from '../configuration';
|
||||
// import { Logger } from '../logger';
|
||||
@@ -8,9 +8,21 @@ export function getQuickPickIgnoreFocusOut() {
|
||||
return !workspace.getConfiguration('gitlens').get<IAdvancedConfig>('advanced').quickPick.closeOnFocusOut;
|
||||
}
|
||||
|
||||
export function showQuickPickProgress(message: string, mapping?: KeyMapping): CancellationTokenSource {
|
||||
export function showQuickPickProgress(message: string, mapping?: KeyMapping, delay: boolean = false): CancellationTokenSource {
|
||||
const cancellation = new CancellationTokenSource();
|
||||
_showQuickPickProgress(message, cancellation, mapping);
|
||||
|
||||
if (delay) {
|
||||
let disposable: Disposable;
|
||||
const timer = setTimeout(() => {
|
||||
disposable && disposable.dispose();
|
||||
_showQuickPickProgress(message, cancellation, mapping);
|
||||
}, 250);
|
||||
disposable = cancellation.token.onCancellationRequested(() => clearTimeout(timer));
|
||||
}
|
||||
else {
|
||||
_showQuickPickProgress(message, cancellation, mapping);
|
||||
}
|
||||
|
||||
return cancellation;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress
|
||||
|
||||
export class RepoHistoryQuickPick {
|
||||
|
||||
static showProgress(maxCount?: number) {
|
||||
return showQuickPickProgress(`Loading repository history \u2014 ${maxCount ? ` limited to ${maxCount} commits` : ` this may take a while`}\u2026`,
|
||||
static showProgress() {
|
||||
return showQuickPickProgress('Repository history \u2014 search by commit message, filename, or sha',
|
||||
{
|
||||
left: KeyNoopCommand,
|
||||
',': KeyNoopCommand,
|
||||
@@ -22,11 +22,11 @@ export class RepoHistoryQuickPick {
|
||||
|
||||
let previousPageCommand: CommandQuickPickItem;
|
||||
|
||||
if (log.truncated || uri.sha) {
|
||||
if (log.truncated || (uri && uri.sha)) {
|
||||
items.splice(0, 0, new CommandQuickPickItem({
|
||||
label: `$(sync) Show All Commits`,
|
||||
description: `\u00a0 \u2014 \u00a0\u00a0 this may take a while`
|
||||
}, Commands.ShowQuickRepoHistory, [Uri.file(uri.fsPath), 0, goBackCommand]));
|
||||
}, Commands.ShowQuickRepoHistory, [uri && Uri.file(uri.fsPath), 0, goBackCommand]));
|
||||
|
||||
if (nextPageCommand) {
|
||||
items.splice(0, 0, nextPageCommand);
|
||||
@@ -43,7 +43,7 @@ export class RepoHistoryQuickPick {
|
||||
previousPageCommand = new CommandQuickPickItem({
|
||||
label: `$(arrow-left) Show Previous Commits`,
|
||||
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} older commits`
|
||||
}, Commands.ShowQuickRepoHistory, [new GitUri(uri, last), log.maxCount, goBackCommand, undefined, npc]);
|
||||
}, Commands.ShowQuickRepoHistory, [new GitUri(uri ? uri : last.uri, last), log.maxCount, goBackCommand, undefined, npc]);
|
||||
|
||||
items.splice(0, 0, previousPageCommand);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ export class RepoHistoryQuickPick {
|
||||
const pick = await window.showQuickPick(items, {
|
||||
matchOnDescription: true,
|
||||
matchOnDetail: true,
|
||||
placeHolder: 'Search by commit message, filename, or sha',
|
||||
placeHolder: 'Repository history \u2014 search by commit message, filename, or sha',
|
||||
ignoreFocusOut: getQuickPickIgnoreFocusOut()
|
||||
// onDidSelectItem: (item: QuickPickItem) => {
|
||||
// scope.setKeyCommand('right', item);
|
||||
|
||||
Reference in New Issue
Block a user