Skip to content

Commit cc7fe1f

Browse files
committed
Fixes cases of stuck progress indicators
1 parent 17a5f14 commit cc7fe1f

File tree

5 files changed

+25
-11
lines changed

5 files changed

+25
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
2020
- Fixes 🤞 [#216](https://github.com/eamodio/vscode-gitlens/issues/216) - PowerShell session not started if GitLen is enabled
2121
- Fixes [#217](https://github.com/eamodio/vscode-gitlens/issues/217) - empty editor has git lens in status bar with old information
2222
- Fixes [#218](https://github.com/eamodio/vscode-gitlens/issues/218) - Cannot read property 'replace' of undefined
23+
- Fixes issue with feedback when searching for commits without any matches
24+
- Fixes issue where quickpick progress indicators could get stuck
2325

2426
## [6.2.0] - 2017-11-27
2527
### Added

src/commands/diffWithRevision.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,8 @@ export class DiffWithRevisionCommand extends ActiveEditorCommand {
6767
Logger.error(ex, 'DiffWithRevisionCommand');
6868
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
6969
}
70-
}
70+
finally {
71+
progressCancellation.dispose();
72+
}
73+
}
7174
}

src/commands/showCommitSearch.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
8686
switch (args.searchBy) {
8787
case GitRepoSearchBy.Author:
8888
originalSearch = `@${args.search}`;
89-
placeHolder = `commits with author matching '${args.search}'`;
89+
placeHolder = `commits with an author matching '${args.search}'`;
9090
break;
9191

9292
case GitRepoSearchBy.Changes:
@@ -106,19 +106,18 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
106106

107107
case GitRepoSearchBy.Message:
108108
originalSearch = args.search;
109-
placeHolder = `commits with message matching '${args.search}'`;
109+
placeHolder = `commits with a message matching '${args.search}'`;
110110
break;
111111

112112
case GitRepoSearchBy.Sha:
113113
originalSearch = `#${args.search}`;
114-
placeHolder = `commits with id matching '${args.search}'`;
114+
placeHolder = `commits with an id matching '${args.search}'`;
115115
break;
116116
}
117117

118118
const progressCancellation = CommitsQuickPick.showProgress(placeHolder!);
119119
try {
120120
const log = await this.git.getLogForRepoSearch(repoPath, args.search, args.searchBy);
121-
if (log === undefined) return undefined;
122121

123122
if (progressCancellation.token.isCancellationRequested) return undefined;
124123

@@ -157,5 +156,8 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
157156
Logger.error(ex, 'ShowCommitSearchCommand');
158157
return window.showErrorMessage(`Unable to find commits. See output channel for more details`);
159158
}
159+
finally {
160+
progressCancellation.dispose();
161+
}
160162
}
161163
}

src/quickPicks/commits.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Iterables } from '../system';
33
import { CancellationTokenSource, QuickPickOptions, window } from 'vscode';
44
import { GitLog, GitService } from '../gitService';
55
import { Keyboard, KeyNoopCommand } from '../keyboard';
6-
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from '../quickPicks';
6+
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, MessageQuickPickItem, showQuickPickProgress } from '../quickPicks';
77

88
export class CommitsQuickPick {
99

@@ -16,8 +16,8 @@ export class CommitsQuickPick {
1616
});
1717
}
1818

19-
static async show(git: GitService, log: GitLog, placeHolder: string, progressCancellation: CancellationTokenSource, goBackCommand?: CommandQuickPickItem): Promise<CommitQuickPickItem | CommandQuickPickItem | undefined> {
20-
const items = ((log && [...Iterables.map(log.commits.values(), c => new CommitQuickPickItem(c))]) || []) as (CommitQuickPickItem | CommandQuickPickItem)[];
19+
static async show(git: GitService, log: GitLog | undefined, placeHolder: string, progressCancellation: CancellationTokenSource, goBackCommand?: CommandQuickPickItem): Promise<CommitQuickPickItem | CommandQuickPickItem | undefined> {
20+
const items = ((log && [...Iterables.map(log.commits.values(), c => new CommitQuickPickItem(c))]) || [new MessageQuickPickItem('No results found')]) as (CommitQuickPickItem | CommandQuickPickItem)[];
2121

2222
if (goBackCommand !== undefined) {
2323
items.splice(0, 0, goBackCommand);

src/quickPicks/common.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ export class CommandQuickPickItem implements QuickPickItem {
104104
}
105105
}
106106

107+
export class MessageQuickPickItem extends CommandQuickPickItem {
108+
109+
constructor(message: string) {
110+
super({ label: message, description: '' } as QuickPickItem);
111+
}
112+
}
113+
107114
export class KeyCommandQuickPickItem extends CommandQuickPickItem {
108115

109116
constructor(command: Commands, args?: any[]) {
@@ -113,7 +120,7 @@ export class KeyCommandQuickPickItem extends CommandQuickPickItem {
113120

114121
export class OpenFileCommandQuickPickItem extends CommandQuickPickItem {
115122

116-
constructor(public uri: Uri, item: QuickPickItem) {
123+
constructor(public readonly uri: Uri, item: QuickPickItem) {
117124
super(item, undefined, undefined);
118125
}
119126

@@ -138,7 +145,7 @@ export class OpenFileCommandQuickPickItem extends CommandQuickPickItem {
138145

139146
export class OpenFilesCommandQuickPickItem extends CommandQuickPickItem {
140147

141-
constructor(public uris: Uri[], item: QuickPickItem) {
148+
constructor(public readonly uris: Uri[], item: QuickPickItem) {
142149
super(item, undefined, undefined);
143150
}
144151

@@ -163,7 +170,7 @@ export class CommitQuickPickItem implements QuickPickItem {
163170
description: string;
164171
detail: string;
165172

166-
constructor(public commit: GitCommit) {
173+
constructor(public readonly commit: GitCommit) {
167174
let message = commit.message;
168175
const index = message.indexOf('\n');
169176
if (index !== -1) {

0 commit comments

Comments
 (0)