mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-24 17:24:53 -05:00
Adds 'Show Stashed Changes` command
Adds experimental 'Apply Stashed Changes' command Adds experimental 'Delete Stashed Changes' to stashed changes quick pick
This commit is contained in:
32
src/quickPicks/stashList.ts
Normal file
32
src/quickPicks/stashList.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
'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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user