Browse Source

Fixes cases of stuck progress indicators

main
Eric Amodio 7 years ago
parent
commit
cc7fe1fd46
5 changed files with 25 additions and 11 deletions
  1. +2
    -0
      CHANGELOG.md
  2. +4
    -1
      src/commands/diffWithRevision.ts
  3. +6
    -4
      src/commands/showCommitSearch.ts
  4. +3
    -3
      src/quickPicks/commits.ts
  5. +10
    -3
      src/quickPicks/common.ts

+ 2
- 0
CHANGELOG.md View File

@ -20,6 +20,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Fixes 🤞 [#216](https://github.com/eamodio/vscode-gitlens/issues/216) - PowerShell session not started if GitLen is enabled
- Fixes [#217](https://github.com/eamodio/vscode-gitlens/issues/217) - empty editor has git lens in status bar with old information
- Fixes [#218](https://github.com/eamodio/vscode-gitlens/issues/218) - Cannot read property 'replace' of undefined
- Fixes issue with feedback when searching for commits without any matches
- Fixes issue where quickpick progress indicators could get stuck
## [6.2.0] - 2017-11-27
### Added

+ 4
- 1
src/commands/diffWithRevision.ts View File

@ -67,5 +67,8 @@ export class DiffWithRevisionCommand extends ActiveEditorCommand {
Logger.error(ex, 'DiffWithRevisionCommand');
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
}
}
finally {
progressCancellation.dispose();
}
}
}

+ 6
- 4
src/commands/showCommitSearch.ts View File

@ -86,7 +86,7 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
switch (args.searchBy) {
case GitRepoSearchBy.Author:
originalSearch = `@${args.search}`;
placeHolder = `commits with author matching '${args.search}'`;
placeHolder = `commits with an author matching '${args.search}'`;
break;
case GitRepoSearchBy.Changes:
@ -106,19 +106,18 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
case GitRepoSearchBy.Message:
originalSearch = args.search;
placeHolder = `commits with message matching '${args.search}'`;
placeHolder = `commits with a message matching '${args.search}'`;
break;
case GitRepoSearchBy.Sha:
originalSearch = `#${args.search}`;
placeHolder = `commits with id matching '${args.search}'`;
placeHolder = `commits with an id matching '${args.search}'`;
break;
}
const progressCancellation = CommitsQuickPick.showProgress(placeHolder!);
try {
const log = await this.git.getLogForRepoSearch(repoPath, args.search, args.searchBy);
if (log === undefined) return undefined;
if (progressCancellation.token.isCancellationRequested) return undefined;
@ -157,5 +156,8 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
Logger.error(ex, 'ShowCommitSearchCommand');
return window.showErrorMessage(`Unable to find commits. See output channel for more details`);
}
finally {
progressCancellation.dispose();
}
}
}

+ 3
- 3
src/quickPicks/commits.ts View File

@ -3,7 +3,7 @@ import { Iterables } from '../system';
import { CancellationTokenSource, QuickPickOptions, window } from 'vscode';
import { GitLog, GitService } from '../gitService';
import { Keyboard, KeyNoopCommand } from '../keyboard';
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from '../quickPicks';
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, MessageQuickPickItem, showQuickPickProgress } from '../quickPicks';
export class CommitsQuickPick {
@ -16,8 +16,8 @@ export class CommitsQuickPick {
});
}
static async show(git: GitService, log: GitLog, placeHolder: string, progressCancellation: CancellationTokenSource, goBackCommand?: CommandQuickPickItem): Promise<CommitQuickPickItem | CommandQuickPickItem | undefined> {
const items = ((log && [...Iterables.map(log.commits.values(), c => new CommitQuickPickItem(c))]) || []) as (CommitQuickPickItem | CommandQuickPickItem)[];
static async show(git: GitService, log: GitLog | undefined, placeHolder: string, progressCancellation: CancellationTokenSource, goBackCommand?: CommandQuickPickItem): Promise<CommitQuickPickItem | CommandQuickPickItem | undefined> {
const items = ((log && [...Iterables.map(log.commits.values(), c => new CommitQuickPickItem(c))]) || [new MessageQuickPickItem('No results found')]) as (CommitQuickPickItem | CommandQuickPickItem)[];
if (goBackCommand !== undefined) {
items.splice(0, 0, goBackCommand);

+ 10
- 3
src/quickPicks/common.ts View File

@ -104,6 +104,13 @@ export class CommandQuickPickItem implements QuickPickItem {
}
}
export class MessageQuickPickItem extends CommandQuickPickItem {
constructor(message: string) {
super({ label: message, description: '' } as QuickPickItem);
}
}
export class KeyCommandQuickPickItem extends CommandQuickPickItem {
constructor(command: Commands, args?: any[]) {
@ -113,7 +120,7 @@ export class KeyCommandQuickPickItem extends CommandQuickPickItem {
export class OpenFileCommandQuickPickItem extends CommandQuickPickItem {
constructor(public uri: Uri, item: QuickPickItem) {
constructor(public readonly uri: Uri, item: QuickPickItem) {
super(item, undefined, undefined);
}
@ -138,7 +145,7 @@ export class OpenFileCommandQuickPickItem extends CommandQuickPickItem {
export class OpenFilesCommandQuickPickItem extends CommandQuickPickItem {
constructor(public uris: Uri[], item: QuickPickItem) {
constructor(public readonly uris: Uri[], item: QuickPickItem) {
super(item, undefined, undefined);
}
@ -163,7 +170,7 @@ export class CommitQuickPickItem implements QuickPickItem {
description: string;
detail: string;
constructor(public commit: GitCommit) {
constructor(public readonly commit: GitCommit) {
let message = commit.message;
const index = message.indexOf('\n');
if (index !== -1) {

Loading…
Cancel
Save