mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 18:48:45 -05:00
Adds paging support to repo/file quick picks
Adds keyboard support to page in repo/file quick picks Adds progress indicator for repo/file quick picks Completely reworks keyboard scopes
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
import { commands } from 'vscode';
|
import { commands } from 'vscode';
|
||||||
import { BuiltInCommands } from './constants';
|
import { BuiltInCommands } from './constants';
|
||||||
|
|
||||||
export { Keyboard, Keys } from './commands/keyboard';
|
export { Keyboard, KeyboardScope, KeyMapping, KeyNoopCommand, Keys } from './commands/keyboard';
|
||||||
|
|
||||||
export { ActiveEditorCommand, Command, Commands, EditorCommand, openEditor } from './commands/commands';
|
export { ActiveEditorCommand, Command, Commands, EditorCommand, openEditor } from './commands/commands';
|
||||||
export { CloseUnchangedFilesCommand } from './commands/closeUnchangedFiles';
|
export { CloseUnchangedFilesCommand } from './commands/closeUnchangedFiles';
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { commands, Disposable, ExtensionContext, QuickPickItem } from 'vscode';
|
import { commands, Disposable, QuickPickItem } from 'vscode';
|
||||||
import { CommandContext, setCommandContext } from '../commands';
|
import { CommandContext, setCommandContext } from '../commands';
|
||||||
import { CommandQuickPickItem, OpenFileCommandQuickPickItem } from '../quickPicks/quickPicks';
|
import { CommandQuickPickItem, OpenFileCommandQuickPickItem } from '../quickPicks/quickPicks';
|
||||||
import { Logger } from '../logger';
|
import { Logger } from '../logger';
|
||||||
|
|
||||||
|
const keyNoopCommand = Object.create(null) as QuickPickItem;
|
||||||
|
export { keyNoopCommand as KeyNoopCommand };
|
||||||
|
|
||||||
export declare type Keys = 'left' | 'right' | ',' | '.';
|
export declare type Keys = 'left' | 'right' | ',' | '.';
|
||||||
export const keys: Keys[] = [
|
export const keys: Keys[] = [
|
||||||
'left',
|
'left',
|
||||||
@@ -12,16 +15,72 @@ export const keys: Keys[] = [
|
|||||||
'.'
|
'.'
|
||||||
];
|
];
|
||||||
|
|
||||||
let scopeCount = 0;
|
export declare type KeyMapping = { [id: string]: (QuickPickItem | (() => Promise<QuickPickItem>)) };
|
||||||
let counters = {
|
let mappings: KeyMapping[] = [];
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
',': 0,
|
|
||||||
'.': 0
|
|
||||||
};
|
|
||||||
|
|
||||||
let _instance: Keyboard;
|
let _instance: Keyboard;
|
||||||
|
|
||||||
|
export class KeyboardScope extends Disposable {
|
||||||
|
|
||||||
|
constructor(private mapping: KeyMapping) {
|
||||||
|
super(() => this.dispose());
|
||||||
|
|
||||||
|
for (const key in mapping) {
|
||||||
|
mapping[key] = mapping[key] || keyNoopCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async dispose() {
|
||||||
|
const index = mappings.indexOf(this.mapping);
|
||||||
|
Logger.log('KeyboardScope.dispose', mappings.length, index);
|
||||||
|
if (index === (mappings.length - 1)) {
|
||||||
|
mappings.pop();
|
||||||
|
await this.updateKeyCommandsContext(mappings[mappings.length - 1]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mappings.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async begin() {
|
||||||
|
mappings.push(this.mapping);
|
||||||
|
await this.updateKeyCommandsContext(this.mapping);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
async clearKeyCommand(key: Keys) {
|
||||||
|
const mapping = mappings[mappings.length - 1];
|
||||||
|
if (mapping !== this.mapping || !mapping[key]) return;
|
||||||
|
|
||||||
|
Logger.log('KeyboardScope.clearKeyCommand', mappings.length, key);
|
||||||
|
mapping[key] = undefined;
|
||||||
|
await setCommandContext(`${CommandContext.Key}:${key}`, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
async setKeyCommand(key: Keys, command: QuickPickItem | (() => Promise<QuickPickItem>)) {
|
||||||
|
const mapping = mappings[mappings.length - 1];
|
||||||
|
if (mapping !== this.mapping) return;
|
||||||
|
|
||||||
|
Logger.log('KeyboardScope.setKeyCommand', mappings.length, key, !!mapping[key]);
|
||||||
|
|
||||||
|
if (!mapping[key]) {
|
||||||
|
mapping[key] = command;
|
||||||
|
await setCommandContext(`${CommandContext.Key}:${key}`, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mapping[key] = command;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async updateKeyCommandsContext(mapping: KeyMapping) {
|
||||||
|
const promises = [];
|
||||||
|
for (const key of keys) {
|
||||||
|
promises.push(setCommandContext(`${CommandContext.Key}:${key}`, !!(mapping && mapping[key])));
|
||||||
|
}
|
||||||
|
await Promise.all(promises);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class Keyboard extends Disposable {
|
export class Keyboard extends Disposable {
|
||||||
|
|
||||||
static get instance(): Keyboard {
|
static get instance(): Keyboard {
|
||||||
@@ -30,7 +89,7 @@ export class Keyboard extends Disposable {
|
|||||||
|
|
||||||
private _disposable: Disposable;
|
private _disposable: Disposable;
|
||||||
|
|
||||||
constructor(private context: ExtensionContext) {
|
constructor() {
|
||||||
super(() => this.dispose());
|
super(() => this.dispose());
|
||||||
|
|
||||||
const subscriptions: Disposable[] = [];
|
const subscriptions: Disposable[] = [];
|
||||||
@@ -48,8 +107,18 @@ export class Keyboard extends Disposable {
|
|||||||
this._disposable && this._disposable.dispose();
|
this._disposable && this._disposable.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async beginScope(mapping?: KeyMapping): Promise<KeyboardScope> {
|
||||||
|
Logger.log('Keyboard.beginScope', mappings.length);
|
||||||
|
return await new KeyboardScope(mapping ? Object.assign(Object.create(null), mapping) : Object.create(null)).begin();
|
||||||
|
}
|
||||||
|
|
||||||
async execute(key: Keys): Promise<{}> {
|
async execute(key: Keys): Promise<{}> {
|
||||||
let command = this.context.globalState.get(`gitlens:key:${key}`) as CommandQuickPickItem | (() => Promise<CommandQuickPickItem>);
|
if (!mappings.length) return undefined;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const mapping = mappings[mappings.length - 1];
|
||||||
|
|
||||||
|
let command = mapping[key] as CommandQuickPickItem | (() => Promise<CommandQuickPickItem>);
|
||||||
if (typeof command === 'function') {
|
if (typeof command === 'function') {
|
||||||
command = await command();
|
command = await command();
|
||||||
}
|
}
|
||||||
@@ -64,46 +133,9 @@ export class Keyboard extends Disposable {
|
|||||||
|
|
||||||
return await command.execute();
|
return await command.execute();
|
||||||
}
|
}
|
||||||
|
catch (ex) {
|
||||||
async enterScope(...keyCommands: [Keys, QuickPickItem | (() => Promise<QuickPickItem>)][]) {
|
Logger.error('Keyboard.execute', ex);
|
||||||
Logger.log('Keyboard.enterScope', scopeCount);
|
return undefined;
|
||||||
scopeCount++;
|
|
||||||
// await setCommandContext(CommandContext.Key, ++scopeCount);
|
|
||||||
if (keyCommands && Array.isArray(keyCommands) && keyCommands.length) {
|
|
||||||
for (const [key, command] of keyCommands) {
|
|
||||||
await setCommandContext(`${CommandContext.Key}:${key}`, ++counters[key]);
|
|
||||||
await this.setKeyCommand(key as Keys, command);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
async exitScope(clear: boolean = true) {
|
|
||||||
Logger.log('Keyboard.exitScope', scopeCount);
|
|
||||||
if (scopeCount) {
|
|
||||||
scopeCount--;
|
|
||||||
// await setCommandContext(CommandContext.Key, --scopeCount);
|
|
||||||
}
|
|
||||||
if (clear && !scopeCount) {
|
|
||||||
for (const key of keys) {
|
|
||||||
if (counters[key]) {
|
|
||||||
await setCommandContext(`${CommandContext.Key}:${key}`, --counters[key]);
|
|
||||||
}
|
|
||||||
await this.clearKeyCommand(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async clearKeyCommand(key: Keys) {
|
|
||||||
Logger.log('Keyboard.clearKeyCommand', key);
|
|
||||||
if (counters[key]) {
|
|
||||||
await setCommandContext(`${CommandContext.Key}:${key}`, --counters[key]);
|
|
||||||
}
|
|
||||||
await this.context.globalState.update(`gitlens:key:${key}`, undefined);
|
|
||||||
}
|
|
||||||
|
|
||||||
async setKeyCommand(key: Keys, command: QuickPickItem | (() => Promise<QuickPickItem>)) {
|
|
||||||
Logger.log('Keyboard.setKeyCommand', key);
|
|
||||||
await setCommandContext(`${CommandContext.Key}:${key}`, ++counters[key]);
|
|
||||||
await this.context.globalState.update(`gitlens:key:${key}`, command);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||||
import { ActiveEditorCommand, Commands } from './commands';
|
import { ActiveEditorCommand, Commands } from '../commands';
|
||||||
import { GitProvider, GitUri, IGitLog } from '../gitProvider';
|
import { GitProvider, GitUri, IGitLog } from '../gitProvider';
|
||||||
import { Logger } from '../logger';
|
import { Logger } from '../logger';
|
||||||
import { CommandQuickPickItem, FileHistoryQuickPick, showQuickPickProgress } from '../quickPicks';
|
import { CommandQuickPickItem, FileHistoryQuickPick } from '../quickPicks';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
export class ShowQuickFileHistoryCommand extends ActiveEditorCommand {
|
export class ShowQuickFileHistoryCommand extends ActiveEditorCommand {
|
||||||
@@ -12,14 +12,12 @@ export class ShowQuickFileHistoryCommand extends ActiveEditorCommand {
|
|||||||
super(Commands.ShowQuickFileHistory);
|
super(Commands.ShowQuickFileHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
async execute(editor: TextEditor, uri?: Uri, maxCount?: number, goBackCommand?: CommandQuickPickItem, log?: IGitLog) {
|
async execute(editor: TextEditor, uri?: Uri, maxCount?: number, goBackCommand?: CommandQuickPickItem, log?: IGitLog, nextPageCommand?: CommandQuickPickItem) {
|
||||||
if (!(uri instanceof Uri)) {
|
if (!(uri instanceof Uri)) {
|
||||||
uri = editor && editor.document && editor.document.uri;
|
uri = editor && editor.document && editor.document.uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!uri) {
|
if (!uri) return commands.executeCommand(Commands.ShowQuickRepoHistory);
|
||||||
return commands.executeCommand(Commands.ShowQuickRepoHistory);
|
|
||||||
}
|
|
||||||
|
|
||||||
const gitUri = await GitUri.fromUri(uri, this.git);
|
const gitUri = await GitUri.fromUri(uri, this.git);
|
||||||
|
|
||||||
@@ -27,7 +25,7 @@ export class ShowQuickFileHistoryCommand extends ActiveEditorCommand {
|
|||||||
maxCount = this.git.config.advanced.maxQuickHistory;
|
maxCount = this.git.config.advanced.maxQuickHistory;
|
||||||
}
|
}
|
||||||
|
|
||||||
const progressCancellation = showQuickPickProgress(`Loading file history \u2014 ${maxCount ? ` limited to ${maxCount} commits` : ` this may take a while`}\u2026`);
|
const progressCancellation = FileHistoryQuickPick.showProgress(maxCount);
|
||||||
try {
|
try {
|
||||||
if (!log) {
|
if (!log) {
|
||||||
log = await this.git.getLogForFile(gitUri.fsPath, gitUri.sha, gitUri.repoPath, undefined, maxCount);
|
log = await this.git.getLogForFile(gitUri.fsPath, gitUri.sha, gitUri.repoPath, undefined, maxCount);
|
||||||
@@ -36,7 +34,7 @@ export class ShowQuickFileHistoryCommand extends ActiveEditorCommand {
|
|||||||
|
|
||||||
if (progressCancellation.token.isCancellationRequested) return undefined;
|
if (progressCancellation.token.isCancellationRequested) return undefined;
|
||||||
|
|
||||||
const pick = await FileHistoryQuickPick.show(log, uri, gitUri.sha, progressCancellation, goBackCommand);
|
const pick = await FileHistoryQuickPick.show(log, gitUri, progressCancellation, goBackCommand, nextPageCommand);
|
||||||
if (!pick) return undefined;
|
if (!pick) return undefined;
|
||||||
|
|
||||||
if (pick instanceof CommandQuickPickItem) {
|
if (pick instanceof CommandQuickPickItem) {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||||
import { ActiveEditorCommand, Commands } from './commands';
|
import { ActiveEditorCommand, Commands } from '../commands';
|
||||||
import { GitProvider, GitUri, IGitLog } from '../gitProvider';
|
import { GitProvider, GitUri, IGitLog } from '../gitProvider';
|
||||||
import { Logger } from '../logger';
|
import { Logger } from '../logger';
|
||||||
import { CommandQuickPickItem, RepoHistoryQuickPick, showQuickPickProgress } from '../quickPicks';
|
import { CommandQuickPickItem, RepoHistoryQuickPick } from '../quickPicks';
|
||||||
|
|
||||||
export class ShowQuickRepoHistoryCommand extends ActiveEditorCommand {
|
export class ShowQuickRepoHistoryCommand extends ActiveEditorCommand {
|
||||||
|
|
||||||
@@ -11,30 +11,33 @@ export class ShowQuickRepoHistoryCommand extends ActiveEditorCommand {
|
|||||||
super(Commands.ShowQuickRepoHistory);
|
super(Commands.ShowQuickRepoHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
async execute(editor: TextEditor, uri?: Uri, sha?: string, maxCount?: number | undefined, goBackCommand?: CommandQuickPickItem, log?: IGitLog) {
|
async execute(editor: TextEditor, uri?: Uri, maxCount?: number, goBackCommand?: CommandQuickPickItem, log?: IGitLog, nextPageCommand?: CommandQuickPickItem) {
|
||||||
if (!(uri instanceof Uri)) {
|
if (!(uri instanceof Uri)) {
|
||||||
uri = editor && editor.document && editor.document.uri;
|
uri = editor && editor.document && editor.document.uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gitUri = await GitUri.fromUri(uri, this.git);
|
||||||
|
Logger.log(`ShowQuickRepoHistoryCommand.execute`, gitUri.shortSha);
|
||||||
|
|
||||||
if (maxCount == null) {
|
if (maxCount == null) {
|
||||||
maxCount = this.git.config.advanced.maxQuickHistory;
|
maxCount = this.git.config.advanced.maxQuickHistory;
|
||||||
}
|
}
|
||||||
|
|
||||||
const progressCancellation = showQuickPickProgress(`Loading repository history \u2014 ${maxCount ? ` limited to ${maxCount} commits` : ` this may take a while`}\u2026`);
|
const progressCancellation = RepoHistoryQuickPick.showProgress(maxCount);
|
||||||
try {
|
try {
|
||||||
if (!log) {
|
if (!log) {
|
||||||
const repoPath = await this.git.getRepoPathFromUri(uri, this.repoPath);
|
const repoPath = gitUri.repoPath || await this.git.getRepoPathFromUri(uri, this.repoPath);
|
||||||
if (!repoPath) return window.showWarningMessage(`Unable to show repository history`);
|
if (!repoPath) return window.showWarningMessage(`Unable to show repository history`);
|
||||||
|
|
||||||
if (progressCancellation.token.isCancellationRequested) return undefined;
|
if (progressCancellation.token.isCancellationRequested) return undefined;
|
||||||
|
|
||||||
log = await this.git.getLogForRepo(repoPath, sha, maxCount);
|
log = await this.git.getLogForRepo(repoPath, gitUri.sha, maxCount);
|
||||||
if (!log) return window.showWarningMessage(`Unable to show repository history`);
|
if (!log) return window.showWarningMessage(`Unable to show repository history`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progressCancellation.token.isCancellationRequested) return undefined;
|
if (progressCancellation.token.isCancellationRequested) return undefined;
|
||||||
|
|
||||||
const pick = await RepoHistoryQuickPick.show(log, uri, sha, progressCancellation, goBackCommand);
|
const pick = await RepoHistoryQuickPick.show(log, gitUri, progressCancellation, goBackCommand, nextPageCommand);
|
||||||
if (!pick) return undefined;
|
if (!pick) return undefined;
|
||||||
|
|
||||||
if (pick instanceof CommandQuickPickItem) {
|
if (pick instanceof CommandQuickPickItem) {
|
||||||
@@ -45,7 +48,7 @@ export class ShowQuickRepoHistoryCommand extends ActiveEditorCommand {
|
|||||||
new CommandQuickPickItem({
|
new CommandQuickPickItem({
|
||||||
label: `go back \u21A9`,
|
label: `go back \u21A9`,
|
||||||
description: `\u00a0 \u2014 \u00a0\u00a0 to repository history`
|
description: `\u00a0 \u2014 \u00a0\u00a0 to repository history`
|
||||||
}, Commands.ShowQuickRepoHistory, [uri, sha, maxCount, goBackCommand, log]),
|
}, Commands.ShowQuickRepoHistory, [uri, maxCount, goBackCommand, log]),
|
||||||
log);
|
log);
|
||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ export async function activate(context: ExtensionContext) {
|
|||||||
const activeLineController = new BlameActiveLineController(context, git, blameabilityTracker, annotationController);
|
const activeLineController = new BlameActiveLineController(context, git, blameabilityTracker, annotationController);
|
||||||
context.subscriptions.push(activeLineController);
|
context.subscriptions.push(activeLineController);
|
||||||
|
|
||||||
context.subscriptions.push(new Keyboard(context));
|
context.subscriptions.push(new Keyboard());
|
||||||
|
|
||||||
context.subscriptions.push(new CloseUnchangedFilesCommand(git, repoPath));
|
context.subscriptions.push(new CloseUnchangedFilesCommand(git, repoPath));
|
||||||
context.subscriptions.push(new OpenChangedFilesCommand(git, repoPath));
|
context.subscriptions.push(new OpenChangedFilesCommand(git, repoPath));
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
|
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
|
||||||
import { Commands, Keyboard } from '../commands';
|
import { Commands, Keyboard, KeyNoopCommand } from '../commands';
|
||||||
import { GitLogCommit, GitProvider, IGitLog } from '../gitProvider';
|
import { GitLogCommit, GitProvider, IGitLog } from '../gitProvider';
|
||||||
import { CommitWithFileStatusQuickPickItem } from './gitQuickPicks';
|
import { CommitWithFileStatusQuickPickItem } from './gitQuickPicks';
|
||||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, KeyNoopCommandQuickPickItem, OpenFilesCommandQuickPickItem } from './quickPicks';
|
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFilesCommandQuickPickItem } from './quickPicks';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
@@ -72,30 +72,26 @@ export class CommitDetailsQuickPick {
|
|||||||
items.splice(0, 0, goBackCommand);
|
items.splice(0, 0, goBackCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
const previousCommand = commit.previousSha
|
const previousCommand = commit.previousSha && new KeyCommandQuickPickItem(Commands.ShowQuickCommitDetails, [commit.previousUri, commit.previousSha, undefined, goBackCommand, repoLog]);
|
||||||
? new KeyCommandQuickPickItem(Commands.ShowQuickCommitDetails, [commit.previousUri, commit.previousSha, undefined, goBackCommand, repoLog])
|
|
||||||
: new KeyNoopCommandQuickPickItem();
|
|
||||||
|
|
||||||
let nextCommand: CommandQuickPickItem | (() => Promise<CommandQuickPickItem>);
|
let nextCommand: CommandQuickPickItem | (() => Promise<CommandQuickPickItem>);
|
||||||
if (repoLog) {
|
if (repoLog) {
|
||||||
nextCommand = commit.nextSha
|
nextCommand = commit.nextSha && new KeyCommandQuickPickItem(Commands.ShowQuickCommitDetails, [commit.nextUri, commit.nextSha, undefined, goBackCommand, repoLog]);
|
||||||
? new KeyCommandQuickPickItem(Commands.ShowQuickCommitDetails, [commit.nextUri, commit.nextSha, undefined, goBackCommand, repoLog])
|
|
||||||
: new KeyNoopCommandQuickPickItem();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nextCommand = async () => {
|
nextCommand = async () => {
|
||||||
const log = await git.getLogForRepo(commit.repoPath, undefined, git.config.advanced.maxQuickHistory);
|
const log = await git.getLogForRepo(commit.repoPath, undefined, git.config.advanced.maxQuickHistory);
|
||||||
const c = log && log.commits.get(commit.sha);
|
const c = log && log.commits.get(commit.sha);
|
||||||
if (!c) return new KeyNoopCommandQuickPickItem();
|
if (!c) return KeyNoopCommand;
|
||||||
return new KeyCommandQuickPickItem(Commands.ShowQuickCommitDetails, [c.nextUri, c.nextSha, undefined, goBackCommand, log]);
|
return new KeyCommandQuickPickItem(Commands.ShowQuickCommitDetails, [c.nextUri, c.nextSha, undefined, goBackCommand, log]);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
await Keyboard.instance.enterScope(
|
const scope = await Keyboard.instance.beginScope({
|
||||||
['left', goBackCommand],
|
left: goBackCommand,
|
||||||
[',', previousCommand],
|
',': previousCommand,
|
||||||
['.', nextCommand]
|
'.': nextCommand
|
||||||
);
|
});
|
||||||
|
|
||||||
const pick = await window.showQuickPick(items, {
|
const pick = await window.showQuickPick(items, {
|
||||||
matchOnDescription: true,
|
matchOnDescription: true,
|
||||||
@@ -103,11 +99,11 @@ export class CommitDetailsQuickPick {
|
|||||||
placeHolder: `${commit.shortSha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}`,
|
placeHolder: `${commit.shortSha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}`,
|
||||||
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
|
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
|
||||||
onDidSelectItem: (item: QuickPickItem) => {
|
onDidSelectItem: (item: QuickPickItem) => {
|
||||||
Keyboard.instance.setKeyCommand('right', item);
|
scope.setKeyCommand('right', item);
|
||||||
}
|
}
|
||||||
} as QuickPickOptions);
|
} as QuickPickOptions);
|
||||||
|
|
||||||
await Keyboard.instance.exitScope();
|
await scope.dispose();
|
||||||
|
|
||||||
return pick;
|
return pick;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Iterables } from '../system';
|
import { Iterables } from '../system';
|
||||||
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
|
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
|
||||||
import { Commands, Keyboard } from '../commands';
|
import { Commands, Keyboard, KeyNoopCommand } from '../commands';
|
||||||
import { GitCommit, GitLogCommit, GitProvider, GitUri, IGitLog } from '../gitProvider';
|
import { GitCommit, GitLogCommit, GitProvider, GitUri, IGitLog } from '../gitProvider';
|
||||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, KeyNoopCommandQuickPickItem, OpenFileCommandQuickPickItem } from './quickPicks';
|
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem } from './quickPicks';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
@@ -93,41 +93,37 @@ export class CommitFileDetailsQuickPick {
|
|||||||
items.splice(0, 0, goBackCommand);
|
items.splice(0, 0, goBackCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
const previousCommand = commit.previousSha
|
const previousCommand = commit.previousSha && new KeyCommandQuickPickItem(Commands.ShowQuickCommitFileDetails, [commit.previousUri, commit.previousSha, undefined, goBackCommand, options, fileLog]);
|
||||||
? new KeyCommandQuickPickItem(Commands.ShowQuickCommitFileDetails, [commit.previousUri, commit.previousSha, undefined, goBackCommand, options, fileLog])
|
|
||||||
: new KeyNoopCommandQuickPickItem();
|
|
||||||
|
|
||||||
let nextCommand: CommandQuickPickItem | (() => Promise<CommandQuickPickItem>);
|
let nextCommand: CommandQuickPickItem | (() => Promise<CommandQuickPickItem>);
|
||||||
if (fileLog) {
|
if (fileLog) {
|
||||||
nextCommand = commit.nextSha
|
nextCommand = commit.nextSha && new KeyCommandQuickPickItem(Commands.ShowQuickCommitFileDetails, [commit.nextUri, commit.nextSha, undefined, goBackCommand, options, fileLog]);
|
||||||
? new KeyCommandQuickPickItem(Commands.ShowQuickCommitFileDetails, [commit.nextUri, commit.nextSha, undefined, goBackCommand, options, fileLog])
|
|
||||||
: new KeyNoopCommandQuickPickItem();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nextCommand = async () => {
|
nextCommand = async () => {
|
||||||
const log = await git.getLogForFile(uri.fsPath, undefined, commit.repoPath, undefined, git.config.advanced.maxQuickHistory);
|
const log = await git.getLogForFile(uri.fsPath, undefined, commit.repoPath, undefined, git.config.advanced.maxQuickHistory);
|
||||||
const c = log && log.commits.get(commit.sha);
|
const c = log && log.commits.get(commit.sha);
|
||||||
if (!c) return new KeyNoopCommandQuickPickItem();
|
if (!c) return KeyNoopCommand;
|
||||||
return new KeyCommandQuickPickItem(Commands.ShowQuickCommitFileDetails, [c.nextUri, c.nextSha, undefined, goBackCommand, options, log]);
|
return new KeyCommandQuickPickItem(Commands.ShowQuickCommitFileDetails, [c.nextUri, c.nextSha, undefined, goBackCommand, options, log]);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
await Keyboard.instance.enterScope(
|
const scope = await Keyboard.instance.beginScope({
|
||||||
['left', goBackCommand],
|
left: goBackCommand,
|
||||||
[',', previousCommand],
|
',': previousCommand,
|
||||||
['.', nextCommand]
|
'.': nextCommand
|
||||||
);
|
});
|
||||||
|
|
||||||
const pick = await window.showQuickPick(items, {
|
const pick = await window.showQuickPick(items, {
|
||||||
matchOnDescription: true,
|
matchOnDescription: true,
|
||||||
placeHolder: `${commit.getFormattedPath()} \u2022 ${isUncommitted ? 'Uncommitted \u21E8 ' : '' }${commit.shortSha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}`,
|
placeHolder: `${commit.getFormattedPath()} \u2022 ${isUncommitted ? 'Uncommitted \u21E8 ' : '' }${commit.shortSha} \u2022 ${commit.author}, ${moment(commit.date).fromNow()} \u2022 ${commit.message}`,
|
||||||
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
|
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
|
||||||
onDidSelectItem: (item: QuickPickItem) => {
|
onDidSelectItem: (item: QuickPickItem) => {
|
||||||
Keyboard.instance.setKeyCommand('right', item);
|
scope.setKeyCommand('right', item);
|
||||||
}
|
}
|
||||||
} as QuickPickOptions);
|
} as QuickPickOptions);
|
||||||
|
|
||||||
await Keyboard.instance.exitScope();
|
await scope.dispose();
|
||||||
|
|
||||||
return pick;
|
return pick;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,40 +1,66 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Iterables } from '../system';
|
import { Iterables } from '../system';
|
||||||
import { CancellationTokenSource, QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
|
import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode';
|
||||||
import { Commands, Keyboard } from '../commands';
|
import { Commands, Keyboard, KeyNoopCommand } from '../commands';
|
||||||
import { GitUri, IGitLog } from '../gitProvider';
|
import { GitUri, IGitLog } from '../gitProvider';
|
||||||
import { CommitQuickPickItem } from './gitQuickPicks';
|
import { CommitQuickPickItem } from './gitQuickPicks';
|
||||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut } from './quickPicks';
|
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './quickPicks';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
export class FileHistoryQuickPick {
|
export class FileHistoryQuickPick {
|
||||||
|
|
||||||
static async show(log: IGitLog, uri: Uri, sha: string, progressCancellation: CancellationTokenSource, goBackCommand?: CommandQuickPickItem): Promise<CommitQuickPickItem | CommandQuickPickItem | undefined> {
|
static showProgress(maxCount?: number) {
|
||||||
|
return showQuickPickProgress(`Loading file history \u2014 ${maxCount ? ` limited to ${maxCount} commits` : ` this may take a while`}\u2026`,
|
||||||
|
{
|
||||||
|
left: KeyNoopCommand,
|
||||||
|
',': KeyNoopCommand,
|
||||||
|
'.': KeyNoopCommand
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static async show(log: IGitLog, uri: GitUri, progressCancellation: CancellationTokenSource, goBackCommand?: CommandQuickPickItem, nextPageCommand?: CommandQuickPickItem): Promise<CommitQuickPickItem | CommandQuickPickItem | undefined> {
|
||||||
const items = Array.from(Iterables.map(log.commits.values(), c => new CommitQuickPickItem(c))) as (CommitQuickPickItem | CommandQuickPickItem)[];
|
const items = Array.from(Iterables.map(log.commits.values(), c => new CommitQuickPickItem(c))) as (CommitQuickPickItem | CommandQuickPickItem)[];
|
||||||
|
|
||||||
if (log.truncated) {
|
let previousPageCommand: CommandQuickPickItem;
|
||||||
|
|
||||||
|
let index = 0;
|
||||||
|
if (log.truncated || uri.sha) {
|
||||||
|
index++;
|
||||||
items.splice(0, 0, new CommandQuickPickItem({
|
items.splice(0, 0, new CommandQuickPickItem({
|
||||||
label: `$(sync) Show All Commits`,
|
label: `$(sync) Show All Commits`,
|
||||||
description: `\u00a0 \u2014 \u00a0\u00a0 Currently only showing the first ${log.maxCount} commits`,
|
description: `\u00a0 \u2014 \u00a0\u00a0 this may take a while`
|
||||||
detail: `This may take a while`
|
}, Commands.ShowQuickFileHistory, [Uri.file(uri.fsPath), 0, goBackCommand]));
|
||||||
}, Commands.ShowQuickFileHistory, [uri, 0, goBackCommand]));
|
|
||||||
|
if (nextPageCommand) {
|
||||||
|
index++;
|
||||||
|
items.splice(0, 0, nextPageCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (log.truncated) {
|
||||||
|
const npc = new CommandQuickPickItem({
|
||||||
|
label: `$(arrow-right) Show Next Commits`,
|
||||||
|
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} newer commits`
|
||||||
|
}, Commands.ShowQuickFileHistory, [uri, log.maxCount, goBackCommand, undefined, nextPageCommand]);
|
||||||
|
|
||||||
const last = Iterables.last(log.commits.values());
|
const last = Iterables.last(log.commits.values());
|
||||||
items.push(new CommandQuickPickItem({
|
|
||||||
label: `$(ellipsis) Show More Commits`,
|
previousPageCommand = new CommandQuickPickItem({
|
||||||
description: `\u00a0 \u2014 \u00a0\u00a0 Shows the next ${log.maxCount} commits`
|
label: `$(arrow-left) Show Previous Commits`,
|
||||||
}, Commands.ShowQuickFileHistory, [new GitUri(uri, last), log.maxCount, goBackCommand]));
|
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} older commits`
|
||||||
|
}, Commands.ShowQuickFileHistory, [new GitUri(uri, last), log.maxCount, goBackCommand, undefined, npc]);
|
||||||
|
|
||||||
|
index++;
|
||||||
|
items.splice(0, 0, previousPageCommand);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only show the full repo option if we are the root
|
// Only show the full repo option if we are the root
|
||||||
if (!goBackCommand) {
|
if (!goBackCommand) {
|
||||||
items.splice(0, 0, new CommandQuickPickItem({
|
items.splice(index, 0, new CommandQuickPickItem({
|
||||||
label: `$(repo) Show Repository History`,
|
label: `$(repo) Show Repository History`,
|
||||||
description: null,
|
description: `\u00a0 \u2014 \u00a0\u00a0 shows the repository commit history`
|
||||||
detail: 'Shows the commit history of the repository'
|
|
||||||
}, Commands.ShowQuickRepoHistory,
|
}, Commands.ShowQuickRepoHistory,
|
||||||
[
|
[
|
||||||
undefined,
|
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
new CommandQuickPickItem({
|
new CommandQuickPickItem({
|
||||||
@@ -50,7 +76,11 @@ export class FileHistoryQuickPick {
|
|||||||
|
|
||||||
if (progressCancellation.token.isCancellationRequested) return undefined;
|
if (progressCancellation.token.isCancellationRequested) return undefined;
|
||||||
|
|
||||||
await Keyboard.instance.enterScope(['left', goBackCommand]);
|
const scope = await Keyboard.instance.beginScope({
|
||||||
|
left: goBackCommand,
|
||||||
|
',': previousPageCommand,
|
||||||
|
'.': nextPageCommand
|
||||||
|
});
|
||||||
|
|
||||||
const commit = Iterables.first(log.commits.values());
|
const commit = Iterables.first(log.commits.values());
|
||||||
|
|
||||||
@@ -59,14 +89,14 @@ export class FileHistoryQuickPick {
|
|||||||
const pick = await window.showQuickPick(items, {
|
const pick = await window.showQuickPick(items, {
|
||||||
matchOnDescription: true,
|
matchOnDescription: true,
|
||||||
matchOnDetail: true,
|
matchOnDetail: true,
|
||||||
placeHolder: `${commit.getFormattedPath()}${sha ? ` \u00a0\u2022\u00a0 ${sha.substring(0, 8)}` : ''}`,
|
placeHolder: `${commit.getFormattedPath()}${uri.sha ? ` \u00a0\u2022\u00a0 ${uri.sha.substring(0, 8)}` : ''}`,
|
||||||
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
|
ignoreFocusOut: getQuickPickIgnoreFocusOut()
|
||||||
onDidSelectItem: (item: QuickPickItem) => {
|
// onDidSelectItem: (item: QuickPickItem) => {
|
||||||
Keyboard.instance.setKeyCommand('right', item);
|
// scope.setKeyCommand('right', item);
|
||||||
}
|
// }
|
||||||
} as QuickPickOptions);
|
} as QuickPickOptions);
|
||||||
|
|
||||||
await Keyboard.instance.exitScope();
|
await scope.dispose();
|
||||||
|
|
||||||
return pick;
|
return pick;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,32 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { CancellationTokenSource, commands, QuickPickItem, QuickPickOptions, TextEditor, Uri, window, workspace } from 'vscode';
|
import { CancellationTokenSource, commands, QuickPickItem, QuickPickOptions, TextEditor, Uri, window, workspace } from 'vscode';
|
||||||
import { Commands, openEditor } from '../commands';
|
import { Commands, Keyboard, KeyboardScope, KeyMapping, openEditor } from '../commands';
|
||||||
import { IAdvancedConfig } from '../configuration';
|
import { IAdvancedConfig } from '../configuration';
|
||||||
import { Logger } from '../logger';
|
// import { Logger } from '../logger';
|
||||||
|
|
||||||
export function getQuickPickIgnoreFocusOut() {
|
export function getQuickPickIgnoreFocusOut() {
|
||||||
return !workspace.getConfiguration('gitlens').get<IAdvancedConfig>('advanced').quickPick.closeOnFocusOut;
|
return !workspace.getConfiguration('gitlens').get<IAdvancedConfig>('advanced').quickPick.closeOnFocusOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showQuickPickProgress(message: string): CancellationTokenSource {
|
export function showQuickPickProgress(message: string, mapping?: KeyMapping): CancellationTokenSource {
|
||||||
const cancellation = new CancellationTokenSource();
|
const cancellation = new CancellationTokenSource();
|
||||||
_showQuickPickProgress(message, cancellation);
|
_showQuickPickProgress(message, cancellation, mapping);
|
||||||
return cancellation;
|
return cancellation;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function _showQuickPickProgress(message: string, cancellation: CancellationTokenSource) {
|
async function _showQuickPickProgress(message: string, cancellation: CancellationTokenSource, mapping?: KeyMapping) {
|
||||||
Logger.log(`showQuickPickProgress`, `show`, message);
|
// Logger.log(`showQuickPickProgress`, `show`, message);
|
||||||
|
|
||||||
|
const scope: KeyboardScope = mapping && await Keyboard.instance.beginScope(mapping);
|
||||||
|
|
||||||
await window.showQuickPick(_getInfiniteCancellablePromise(cancellation), {
|
await window.showQuickPick(_getInfiniteCancellablePromise(cancellation), {
|
||||||
placeHolder: message,
|
placeHolder: message,
|
||||||
ignoreFocusOut: getQuickPickIgnoreFocusOut()
|
ignoreFocusOut: getQuickPickIgnoreFocusOut()
|
||||||
} as QuickPickOptions, cancellation.token);
|
} as QuickPickOptions, cancellation.token);
|
||||||
Logger.log(`showQuickPickProgress`, `cancel`, message);
|
|
||||||
|
// Logger.log(`showQuickPickProgress`, `cancel`, message);
|
||||||
|
|
||||||
|
scope && scope.dispose();
|
||||||
cancellation.cancel();
|
cancellation.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +34,7 @@ function _getInfiniteCancellablePromise(cancellation: CancellationTokenSource) {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const disposable = cancellation.token.onCancellationRequested(() => {
|
const disposable = cancellation.token.onCancellationRequested(() => {
|
||||||
disposable.dispose();
|
disposable.dispose();
|
||||||
reject();
|
resolve([]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -55,17 +61,6 @@ export class KeyCommandQuickPickItem extends CommandQuickPickItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class KeyNoopCommandQuickPickItem extends CommandQuickPickItem {
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super({ label: undefined, description: undefined }, undefined, undefined);
|
|
||||||
}
|
|
||||||
|
|
||||||
execute(): Thenable<{}> {
|
|
||||||
return Promise.resolve(undefined);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class OpenFileCommandQuickPickItem extends CommandQuickPickItem {
|
export class OpenFileCommandQuickPickItem extends CommandQuickPickItem {
|
||||||
|
|
||||||
constructor(public uri: Uri, item: QuickPickItem) {
|
constructor(public uri: Uri, item: QuickPickItem) {
|
||||||
|
|||||||
@@ -1,28 +1,52 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Iterables } from '../system';
|
import { Iterables } from '../system';
|
||||||
import { CancellationTokenSource, QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
|
import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode';
|
||||||
import { Commands, Keyboard } from '../commands';
|
import { Commands, Keyboard, KeyNoopCommand } from '../commands';
|
||||||
import { IGitLog } from '../gitProvider';
|
import { GitUri, IGitLog } from '../gitProvider';
|
||||||
import { CommitQuickPickItem } from './gitQuickPicks';
|
import { CommitQuickPickItem } from './gitQuickPicks';
|
||||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut } from './quickPicks';
|
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './quickPicks';
|
||||||
|
|
||||||
export class RepoHistoryQuickPick {
|
export class RepoHistoryQuickPick {
|
||||||
|
|
||||||
static async show(log: IGitLog, uri: Uri, sha: string, progressCancellation: CancellationTokenSource, goBackCommand?: CommandQuickPickItem): Promise<CommitQuickPickItem | CommandQuickPickItem | undefined> {
|
static showProgress(maxCount?: number) {
|
||||||
|
return showQuickPickProgress(`Loading repository history \u2014 ${maxCount ? ` limited to ${maxCount} commits` : ` this may take a while`}\u2026`,
|
||||||
|
{
|
||||||
|
left: KeyNoopCommand,
|
||||||
|
',': KeyNoopCommand,
|
||||||
|
'.': KeyNoopCommand
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static async show(log: IGitLog, uri: GitUri, progressCancellation: CancellationTokenSource, goBackCommand?: CommandQuickPickItem, nextPageCommand?: CommandQuickPickItem): Promise<CommitQuickPickItem | CommandQuickPickItem | undefined> {
|
||||||
const items = Array.from(Iterables.map(log.commits.values(), c => new CommitQuickPickItem(c, ` \u2014 ${c.fileNames}`))) as (CommitQuickPickItem | CommandQuickPickItem)[];
|
const items = Array.from(Iterables.map(log.commits.values(), c => new CommitQuickPickItem(c, ` \u2014 ${c.fileNames}`))) as (CommitQuickPickItem | CommandQuickPickItem)[];
|
||||||
|
|
||||||
if (log.truncated) {
|
let previousPageCommand: CommandQuickPickItem;
|
||||||
|
|
||||||
|
if (log.truncated || uri.sha) {
|
||||||
items.splice(0, 0, new CommandQuickPickItem({
|
items.splice(0, 0, new CommandQuickPickItem({
|
||||||
label: `$(sync) Show All Commits`,
|
label: `$(sync) Show All Commits`,
|
||||||
description: `\u00a0 \u2014 \u00a0\u00a0 Currently only showing the first ${log.maxCount} commits`,
|
description: `\u00a0 \u2014 \u00a0\u00a0 this may take a while`
|
||||||
detail: `This may take a while`
|
}, Commands.ShowQuickRepoHistory, [Uri.file(uri.fsPath), 0, goBackCommand]));
|
||||||
}, Commands.ShowQuickRepoHistory, [uri, undefined, 0, goBackCommand]));
|
|
||||||
|
if (nextPageCommand) {
|
||||||
|
items.splice(0, 0, nextPageCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (log.truncated) {
|
||||||
|
const npc = new CommandQuickPickItem({
|
||||||
|
label: `$(arrow-right) Show Next Commits`,
|
||||||
|
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} newer commits`
|
||||||
|
}, Commands.ShowQuickRepoHistory, [uri, log.maxCount, goBackCommand, undefined, nextPageCommand]);
|
||||||
|
|
||||||
const last = Iterables.last(log.commits.values());
|
const last = Iterables.last(log.commits.values());
|
||||||
items.push(new CommandQuickPickItem({
|
|
||||||
label: `$(ellipsis) Show More Commits`,
|
previousPageCommand = new CommandQuickPickItem({
|
||||||
description: `\u00a0 \u2014 \u00a0\u00a0 Shows the next ${log.maxCount} commits`
|
label: `$(arrow-left) Show Previous Commits`,
|
||||||
}, Commands.ShowQuickRepoHistory, [uri, last.sha, log.maxCount, goBackCommand]));
|
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} older commits`
|
||||||
|
}, Commands.ShowQuickRepoHistory, [new GitUri(uri, last), log.maxCount, goBackCommand, undefined, npc]);
|
||||||
|
|
||||||
|
items.splice(0, 0, previousPageCommand);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (goBackCommand) {
|
if (goBackCommand) {
|
||||||
@@ -31,7 +55,11 @@ export class RepoHistoryQuickPick {
|
|||||||
|
|
||||||
if (progressCancellation.token.isCancellationRequested) return undefined;
|
if (progressCancellation.token.isCancellationRequested) return undefined;
|
||||||
|
|
||||||
await Keyboard.instance.enterScope(['left', goBackCommand]);
|
const scope = await Keyboard.instance.beginScope({
|
||||||
|
left: goBackCommand,
|
||||||
|
',': previousPageCommand,
|
||||||
|
'.': nextPageCommand
|
||||||
|
});
|
||||||
|
|
||||||
progressCancellation.cancel();
|
progressCancellation.cancel();
|
||||||
|
|
||||||
@@ -39,13 +67,13 @@ export class RepoHistoryQuickPick {
|
|||||||
matchOnDescription: true,
|
matchOnDescription: true,
|
||||||
matchOnDetail: true,
|
matchOnDetail: true,
|
||||||
placeHolder: 'Search by commit message, filename, or sha',
|
placeHolder: 'Search by commit message, filename, or sha',
|
||||||
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
|
ignoreFocusOut: getQuickPickIgnoreFocusOut()
|
||||||
onDidSelectItem: (item: QuickPickItem) => {
|
// onDidSelectItem: (item: QuickPickItem) => {
|
||||||
Keyboard.instance.setKeyCommand('right', item);
|
// scope.setKeyCommand('right', item);
|
||||||
}
|
// }
|
||||||
} as QuickPickOptions);
|
} as QuickPickOptions);
|
||||||
|
|
||||||
await Keyboard.instance.exitScope();
|
await scope.dispose();
|
||||||
|
|
||||||
return pick;
|
return pick;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,18 +90,18 @@ export class RepoStatusQuickPick {
|
|||||||
items.splice(0, 0, goBackCommand);
|
items.splice(0, 0, goBackCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
await Keyboard.instance.enterScope(['left', goBackCommand]);
|
const scope = await Keyboard.instance.beginScope({ left: goBackCommand });
|
||||||
|
|
||||||
const pick = await window.showQuickPick(items, {
|
const pick = await window.showQuickPick(items, {
|
||||||
matchOnDescription: true,
|
matchOnDescription: true,
|
||||||
placeHolder: statuses.length ? 'Repository has changes' : 'Repository has no changes',
|
placeHolder: statuses.length ? 'Repository has changes' : 'Repository has no changes',
|
||||||
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
|
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
|
||||||
onDidSelectItem: (item: QuickPickItem) => {
|
onDidSelectItem: (item: QuickPickItem) => {
|
||||||
Keyboard.instance.setKeyCommand('right', item);
|
scope.setKeyCommand('right', item);
|
||||||
}
|
}
|
||||||
} as QuickPickOptions);
|
} as QuickPickOptions);
|
||||||
|
|
||||||
await Keyboard.instance.exitScope();
|
await scope.dispose();
|
||||||
|
|
||||||
return pick;
|
return pick;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user