mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-16 09:35:40 -05:00
Adds experimental 'Apply Stashed Changes' command Adds experimental 'Delete Stashed Changes' to stashed changes quick pick
32 lines
1.3 KiB
TypeScript
32 lines
1.3 KiB
TypeScript
'use strict';
|
|
import { Iterables } from '../system';
|
|
import { QuickPickOptions, window } from 'vscode';
|
|
import { Keyboard } from '../commands';
|
|
import { IGitStash } from '../gitService';
|
|
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut } from '../quickPicks';
|
|
|
|
export class StashListQuickPick {
|
|
|
|
static async show(stash: IGitStash, placeHolder?: string, goBackCommand?: CommandQuickPickItem): Promise<CommitQuickPickItem | CommandQuickPickItem | undefined> {
|
|
const items = ((stash && Array.from(Iterables.map(stash.commits.values(), c => new CommitQuickPickItem(c, ` \u2014 ${c.fileNames}`)))) || []) as (CommitQuickPickItem | CommandQuickPickItem)[];
|
|
|
|
if (goBackCommand) {
|
|
items.splice(0, 0, goBackCommand);
|
|
}
|
|
|
|
const scope = await Keyboard.instance.beginScope({ left: goBackCommand });
|
|
|
|
const pick = await window.showQuickPick(items, {
|
|
matchOnDescription: true,
|
|
placeHolder: placeHolder || `stash list \u2014 search by message, filename, or sha`,
|
|
ignoreFocusOut: getQuickPickIgnoreFocusOut()
|
|
// onDidSelectItem: (item: QuickPickItem) => {
|
|
// scope.setKeyCommand('right', item);
|
|
// }
|
|
} as QuickPickOptions);
|
|
|
|
await scope.dispose();
|
|
|
|
return pick;
|
|
}
|
|
} |