mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-14 03:58:31 -05:00
Refactors the quickpick menus
Consolidated lots of duplicate functionality go back navigation should be robust now
This commit is contained in:
@@ -1,13 +1,22 @@
|
||||
'use strict';
|
||||
import { QuickPickItem, Uri } from 'vscode';
|
||||
import { commands, QuickPickItem, Uri } from 'vscode';
|
||||
import { Commands } from '../constants';
|
||||
import { GitCommit, GitUri } from '../gitProvider';
|
||||
import * as moment from 'moment';
|
||||
import * as path from 'path';
|
||||
|
||||
export interface CommandQuickPickItem extends QuickPickItem {
|
||||
command: Commands;
|
||||
args?: any[];
|
||||
export class CommandQuickPickItem implements QuickPickItem {
|
||||
label: string;
|
||||
description: string;
|
||||
detail: string;
|
||||
|
||||
constructor(item: QuickPickItem, public command: Commands, public args?: any[]) {
|
||||
Object.assign(this, item);
|
||||
}
|
||||
|
||||
execute() {
|
||||
return commands.executeCommand(this.command, ...(this.args || []));
|
||||
}
|
||||
}
|
||||
|
||||
export class CommitQuickPickItem implements QuickPickItem {
|
||||
@@ -28,25 +37,14 @@ export class FileQuickPickItem implements QuickPickItem {
|
||||
label: string;
|
||||
description: string;
|
||||
detail: string;
|
||||
|
||||
sha: string;
|
||||
uri: GitUri;
|
||||
|
||||
constructor(commit: GitCommit, public fileName: string) {
|
||||
this.label = fileName;
|
||||
|
||||
this.sha = commit.sha;
|
||||
this.uri = GitUri.fromUri(Uri.file(path.resolve(commit.repoPath, fileName)));
|
||||
}
|
||||
}
|
||||
|
||||
export class ShowAllCommitsQuickPickItem implements QuickPickItem {
|
||||
|
||||
label: string;
|
||||
description: string;
|
||||
detail: string;
|
||||
|
||||
constructor(maxItems: number) {
|
||||
this.label = `$(sync) Show Full History`;
|
||||
this.description = `\u2014 Currently only showing the first ${maxItems} commits`;
|
||||
this.detail = `This may take a while`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user