Changes to use enum for glyphs

This commit is contained in:
Eric Amodio
2017-06-13 17:24:22 -04:00
parent 9b908e27ba
commit 45aa9b17ac
32 changed files with 209 additions and 143 deletions

View File

@@ -1,8 +1,9 @@
'use strict';
import { Arrays, Iterables } from '../system';
import { Arrays, Iterables, Strings } from '../system';
import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, ShowCommitSearchCommandArgs, ShowQuickBranchHistoryCommandArgs } from '../commands';
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './common';
import { GlyphChars } from '../constants';
import { GitLog, GitService, GitUri, RemoteResource } from '../gitService';
import { Keyboard, KeyNoopCommand } from '../keyboard';
import { OpenRemotesCommandQuickPickItem } from './remotes';
@@ -10,7 +11,7 @@ import { OpenRemotesCommandQuickPickItem } from './remotes';
export class BranchHistoryQuickPick {
static showProgress(branch: string) {
return showQuickPickProgress(`${branch} history \u2014 search by commit message, filename, or commit id`,
return showQuickPickProgress(`${branch} history ${GlyphChars.Dash} search by commit message, filename, or commit id`,
{
left: KeyNoopCommand,
',': KeyNoopCommand,
@@ -22,8 +23,8 @@ export class BranchHistoryQuickPick {
const items = Array.from(Iterables.map(log.commits.values(), c => new CommitQuickPickItem(c))) as (CommitQuickPickItem | CommandQuickPickItem)[];
const currentCommand = new CommandQuickPickItem({
label: `go back \u21A9`,
description: `\u00a0 \u2014 \u00a0\u00a0 to \u00a0$(git-branch) ${branch} history`
label: `go back ${GlyphChars.ArrowBack}`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} to ${GlyphChars.Space}$(git-branch) ${branch} history`
}, Commands.ShowQuickBranchHistory, [
uri,
{
@@ -44,7 +45,7 @@ export class BranchHistoryQuickPick {
items.splice(0, 0, new CommandQuickPickItem({
label: `$(search) Show Commit Search`,
description: `\u00a0 \u2014 \u00a0\u00a0 search for commits by message, author, files, or commit id`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} search for commits by message, author, files, or commit id`
}, Commands.ShowCommitSearch, [
new GitUri(Uri.file(log.repoPath), { fileName: '', repoPath: log.repoPath }),
{
@@ -58,7 +59,7 @@ export class BranchHistoryQuickPick {
if (log.truncated) {
items.splice(0, 0, new CommandQuickPickItem({
label: `$(sync) Show All Commits`,
description: `\u00a0 \u2014 \u00a0\u00a0 this may take a while`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} this may take a while`
}, Commands.ShowQuickBranchHistory, [
new GitUri(Uri.file(log.repoPath), { fileName: '', repoPath: log.repoPath }),
{
@@ -71,7 +72,7 @@ export class BranchHistoryQuickPick {
else {
items.splice(0, 0, new CommandQuickPickItem({
label: `$(history) Show Branch History`,
description: `\u00a0 \u2014 \u00a0\u00a0 shows \u00a0$(git-branch) ${branch} history`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} shows ${GlyphChars.Space}$(git-branch) ${branch} history`
}, Commands.ShowQuickBranchHistory, [
new GitUri(Uri.file(log.repoPath), { fileName: '', repoPath: log.repoPath }),
{
@@ -88,7 +89,7 @@ export class BranchHistoryQuickPick {
if (log.truncated) {
const npc = new CommandQuickPickItem({
label: `$(arrow-right) Show Next Commits`,
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} newer commits`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} shows ${log.maxCount} newer commits`
}, Commands.ShowQuickBranchHistory, [
uri,
{
@@ -102,7 +103,7 @@ export class BranchHistoryQuickPick {
if (last != null) {
previousPageCommand = new CommandQuickPickItem({
label: `$(arrow-left) Show Previous Commits`,
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} older commits`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} shows ${log.maxCount} older commits`
}, Commands.ShowQuickBranchHistory, [
new GitUri(uri ? uri : last.uri, last),
{
@@ -135,7 +136,7 @@ export class BranchHistoryQuickPick {
const pick = await window.showQuickPick(items, {
matchOnDescription: true,
matchOnDetail: true,
placeHolder: `${branch} history \u2014 search by commit message, filename, or commit id`,
placeHolder: `${branch} history ${GlyphChars.Dash} search by commit message, filename, or commit id`,
ignoreFocusOut: getQuickPickIgnoreFocusOut()
// onDidSelectItem: (item: QuickPickItem) => {
// scope.setKeyCommand('right', item);

View File

@@ -1,7 +1,8 @@
'use strict';
import { QuickPickItem, QuickPickOptions, window } from 'vscode';
import { GitBranch } from '../gitService';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut } from './common';
import { GlyphChars } from '../constants';
import { GitBranch } from '../gitService';
export class BranchQuickPickItem implements QuickPickItem {
@@ -10,8 +11,8 @@ export class BranchQuickPickItem implements QuickPickItem {
detail: string;
constructor(public branch: GitBranch) {
this.label = `${branch.current ? '$(check)\u00a0' : '\u00a0\u00a0\u00a0\u00a0'} ${branch.name}`;
this.description = branch.remote ? '\u00a0\u00a0 remote branch' : '';
this.label = `${branch.current ? `$(check)${GlyphChars.Space}` : GlyphChars.Space.repeat(4)} ${branch.name}`;
this.description = branch.remote ? `${GlyphChars.Space.repeat(2)} remote branch` : '';
}
}

View File

@@ -1,8 +1,9 @@
'use strict';
import { Arrays, Iterables } from '../system';
import { Arrays, Iterables, Strings } from '../system';
import { commands, QuickPickOptions, TextDocumentShowOptions, Uri, window } from 'vscode';
import { Commands, CopyMessageToClipboardCommandArgs, CopyShaToClipboardCommandArgs, DiffDirectoryCommandCommandArgs, DiffWithPreviousCommandArgs, ShowQuickCommitDetailsCommandArgs, StashApplyCommandArgs, StashDeleteCommandArgs } from '../commands';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem, OpenFilesCommandQuickPickItem, QuickPickItem } from './common';
import { GlyphChars } from '../constants';
import { getGitStatusIcon, GitCommit, GitLog, GitLogCommit, GitService, GitStashCommit, GitStatusFile, GitStatusFileStatus, GitUri, IGitCommitInfo, IGitStatusFile, RemoteResource } from '../gitService';
import { Keyboard, KeyNoopCommand, Keys } from '../keyboard';
import { OpenRemotesCommandQuickPickItem } from './remotes';
@@ -34,7 +35,7 @@ export class CommitWithFileStatusQuickPickItem extends OpenFileCommandQuickPickI
}
super(GitService.toGitContentUri(sha, shortSha, status.fileName, commit.repoPath, status.originalFileName), {
label: `\u00a0\u00a0\u00a0\u00a0${icon}\u00a0\u00a0 ${path.basename(status.fileName)}`,
label: `${Strings.pad(icon, 4, 2)} ${path.basename(status.fileName)}`,
description: description
});
@@ -75,7 +76,7 @@ export class OpenCommitFilesCommandQuickPickItem extends OpenFilesCommandQuickPi
super(uris, item || {
label: `$(file-symlink-file) Open Changed Files`,
description: `\u00a0 \u2014 \u00a0\u00a0 in \u00a0$(git-commit) ${commit.shortSha}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} in ${GlyphChars.Space}$(git-commit) ${commit.shortSha}`
// detail: `Opens all of the changed files in $(git-commit) ${commit.shortSha}`
});
}
@@ -106,7 +107,7 @@ export class CommitDetailsQuickPick {
if (stash) {
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(git-pull-request) Apply Stashed Changes`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.message}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} ${commit.message}`
}, Commands.StashApply, [
{
confirm: true,
@@ -118,7 +119,7 @@ export class CommitDetailsQuickPick {
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(x) Delete Stashed Changes`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.message}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} ${commit.message}`
}, Commands.StashDelete, [
{
confirm: true,
@@ -131,7 +132,7 @@ export class CommitDetailsQuickPick {
if (!stash) {
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(clippy) Copy Commit ID to Clipboard`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.shortSha}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} ${commit.shortSha}`
}, Commands.CopyShaToClipboard, [
uri,
{
@@ -142,7 +143,7 @@ export class CommitDetailsQuickPick {
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(clippy) Copy Message to Clipboard`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.message}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} ${commit.message}`
}, Commands.CopyMessageToClipboard, [
uri,
{
@@ -162,7 +163,7 @@ export class CommitDetailsQuickPick {
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(git-compare) Directory Compare with Previous Commit`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.previousShortSha || `${commit.shortSha}^`} \u00a0 $(git-compare) \u00a0 $(git-commit) ${commit.shortSha}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(git-commit) ${commit.previousShortSha || `${commit.shortSha}^`} ${GlyphChars.Space} $(git-compare) ${GlyphChars.Space} $(git-commit) ${commit.shortSha}`
}, Commands.DiffDirectory, [
commit.uri,
{
@@ -174,7 +175,7 @@ export class CommitDetailsQuickPick {
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(git-compare) Directory Compare with Working Tree`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.shortSha} \u00a0 $(git-compare) \u00a0 $(file-directory) Working Tree`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(git-commit) ${commit.shortSha} ${GlyphChars.Space} $(git-compare) ${GlyphChars.Space} $(file-directory) Working Tree`
}, Commands.DiffDirectory, [
uri,
{
@@ -298,7 +299,7 @@ export class CommitDetailsQuickPick {
const pick = await window.showQuickPick(items, {
matchOnDescription: true,
matchOnDetail: true,
placeHolder: `${commit.shortSha} \u00a0\u2022\u00a0 ${commit.author ? `${commit.author}, ` : ''}${moment(commit.date).fromNow()} \u00a0\u2022\u00a0 ${commit.message}`,
placeHolder: `${commit.shortSha} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${commit.author ? `${commit.author}, ` : ''}${moment(commit.date).fromNow()} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${commit.message}`,
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
onDidSelectItem: (item: QuickPickItem) => {
scope.setKeyCommand('right', item);

View File

@@ -1,8 +1,9 @@
'use strict';
import { Arrays, Iterables } from '../system';
import { Arrays, Iterables, Strings } from '../system';
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, CopyMessageToClipboardCommandArgs, CopyShaToClipboardCommandArgs, DiffWithPreviousCommandArgs, DiffWithWorkingCommandArgs, ShowQuickCommitDetailsCommandArgs, ShowQuickCommitFileDetailsCommandArgs, ShowQuickFileHistoryCommandArgs } from '../commands';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem } from './common';
import { GlyphChars } from '../constants';
import { GitBranch, GitLog, GitLogCommit, GitService, GitUri, RemoteResource } from '../gitService';
import { Keyboard, KeyNoopCommand } from '../keyboard';
import { OpenRemotesCommandQuickPickItem } from './remotes';
@@ -16,11 +17,11 @@ export class OpenCommitFileCommandQuickPickItem extends OpenFileCommandQuickPick
let uri: Uri;
if (commit.status === 'D') {
uri = GitService.toGitContentUri(commit.previousSha!, commit.previousShortSha!, commit.previousFileName!, commit.repoPath, undefined);
description = `\u00a0 \u2014 \u00a0\u00a0 ${path.basename(commit.fileName)} in \u00a0$(git-commit) ${commit.previousShortSha} (deleted in \u00a0$(git-commit) ${commit.shortSha})`;
description = `${Strings.pad(GlyphChars.Dash, 2, 3)} ${path.basename(commit.fileName)} in ${GlyphChars.Space}$(git-commit) ${commit.previousShortSha} (deleted in ${GlyphChars.Space}$(git-commit) ${commit.shortSha})`;
}
else {
uri = GitService.toGitContentUri(commit);
description = `\u00a0 \u2014 \u00a0\u00a0 ${path.basename(commit.fileName)} in \u00a0$(git-commit) ${commit.shortSha}`;
description = `${Strings.pad(GlyphChars.Dash, 2, 3)} ${path.basename(commit.fileName)} in ${GlyphChars.Space}$(git-commit) ${commit.shortSha}`;
}
super(uri, item || {
label: `$(file-symlink-file) Open File`,
@@ -35,7 +36,7 @@ export class OpenCommitWorkingTreeFileCommandQuickPickItem extends OpenFileComma
const uri = Uri.file(path.resolve(commit.repoPath, commit.fileName));
super(uri, item || {
label: `$(file-symlink-file) Open Working File`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${path.basename(commit.fileName)}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} ${path.basename(commit.fileName)}`
});
}
}
@@ -61,7 +62,7 @@ export class CommitFileDetailsQuickPick {
if (!stash) {
items.push(new CommandQuickPickItem({
label: `$(git-commit) Show Commit Details`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.shortSha}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(git-commit) ${commit.shortSha}`
}, Commands.ShowQuickCommitDetails, [
new GitUri(commit.uri, commit),
{
@@ -74,7 +75,7 @@ export class CommitFileDetailsQuickPick {
if (commit.previousSha) {
items.push(new CommandQuickPickItem({
label: `$(git-compare) Compare File with Previous`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.previousShortSha} \u00a0 $(git-compare) \u00a0 $(git-commit) ${commit.shortSha}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(git-commit) ${commit.previousShortSha} ${GlyphChars.Space} $(git-compare) ${GlyphChars.Space} $(git-commit) ${commit.shortSha}`
}, Commands.DiffWithPrevious, [
commit.uri,
{
@@ -87,7 +88,7 @@ export class CommitFileDetailsQuickPick {
if (commit.workingFileName) {
items.push(new CommandQuickPickItem({
label: `$(git-compare) Compare File with Working Tree`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(git-commit) ${commit.shortSha} \u00a0 $(git-compare) \u00a0 $(file-text) ${workingName}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(git-commit) ${commit.shortSha} ${GlyphChars.Space} $(git-compare) ${GlyphChars.Space} $(file-text) ${workingName}`
}, Commands.DiffWithWorking, [
Uri.file(path.resolve(commit.repoPath, commit.workingFileName)),
{
@@ -99,7 +100,7 @@ export class CommitFileDetailsQuickPick {
if (!stash) {
items.push(new CommandQuickPickItem({
label: `$(clippy) Copy Commit ID to Clipboard`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.shortSha}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} ${commit.shortSha}`
}, Commands.CopyShaToClipboard, [
uri,
{
@@ -109,7 +110,7 @@ export class CommitFileDetailsQuickPick {
items.push(new CommandQuickPickItem({
label: `$(clippy) Copy Message to Clipboard`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${commit.message}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} ${commit.message}`
}, Commands.CopyMessageToClipboard, [
uri,
{
@@ -146,7 +147,7 @@ export class CommitFileDetailsQuickPick {
if (commit.workingFileName) {
items.push(new CommandQuickPickItem({
label: `$(history) Show File History`,
description: `\u00a0 \u2014 \u00a0\u00a0 of ${path.basename(commit.fileName)}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} of ${path.basename(commit.fileName)}`
}, Commands.ShowQuickFileHistory, [
Uri.file(path.resolve(commit.repoPath, commit.workingFileName)),
{
@@ -159,7 +160,7 @@ export class CommitFileDetailsQuickPick {
if (!stash) {
items.push(new CommandQuickPickItem({
label: `$(history) Show ${commit.workingFileName ? 'Previous ' : ''}File History`,
description: `\u00a0 \u2014 \u00a0\u00a0 of ${path.basename(commit.fileName)} \u00a0\u2022\u00a0 from \u00a0$(git-commit) ${commit.shortSha}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} of ${path.basename(commit.fileName)} ${Strings.pad(GlyphChars.Dot, 1, 1)} from ${GlyphChars.Space}$(git-commit) ${commit.shortSha}`
}, Commands.ShowQuickFileHistory, [
new GitUri(commit.uri, commit),
{
@@ -274,7 +275,7 @@ export class CommitFileDetailsQuickPick {
const pick = await window.showQuickPick(items, {
matchOnDescription: true,
placeHolder: `${commit.getFormattedPath()} \u00a0\u2022\u00a0 ${isUncommitted ? 'Uncommitted \u21E8 ' : '' }${commit.shortSha} \u00a0\u2022\u00a0 ${commit.author}, ${moment(commit.date).fromNow()} \u00a0\u2022\u00a0 ${commit.message}`,
placeHolder: `${commit.getFormattedPath()} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${isUncommitted ? `Uncommitted ${GlyphChars.ArrowRightHollow} ` : '' }${commit.shortSha} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${commit.author}, ${moment(commit.date).fromNow()} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${commit.message}`,
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
onDidSelectItem: (item: QuickPickItem) => {
scope.setKeyCommand('right', item);

View File

@@ -1,7 +1,9 @@
'use strict';
import { Strings } from '../system';
import { CancellationTokenSource, commands, Disposable, QuickPickItem, QuickPickOptions, TextDocumentShowOptions, TextEditor, Uri, window, workspace } from 'vscode';
import { Commands, openEditor } from '../commands';
import { ExtensionKey, IAdvancedConfig } from '../configuration';
import { GlyphChars } from '../constants';
import { GitCommit, GitLogCommit, GitStashCommit } from '../gitService';
import { Keyboard, KeyboardScope, KeyMapping, Keys } from '../keyboard';
// import { Logger } from '../logger';
@@ -166,18 +168,18 @@ export class CommitQuickPickItem implements QuickPickItem {
let message = commit.message;
const index = message.indexOf('\n');
if (index !== -1) {
message = `${message.substring(0, index)}\u00a0$(ellipsis)`;
message = `${message.substring(0, index)}${GlyphChars.Space}$(ellipsis)`;
}
if (commit instanceof GitStashCommit) {
this.label = message;
this.description = '';
this.detail = `\u00a0 ${commit.stashName}\u00a0\u00a0\u2022\u00a0 ${moment(commit.date).fromNow()}\u00a0\u00a0\u2022\u00a0 ${commit.getDiffStatus()}`;
this.detail = `${GlyphChars.Space} ${commit.stashName} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${moment(commit.date).fromNow()} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${commit.getDiffStatus()}`;
}
else {
this.label = message;
this.description = `\u00a0$(git-commit)\u00a0 ${commit.shortSha}`;
this.detail = `\u00a0 ${commit.author}, ${moment(commit.date).fromNow()}${(commit.type === 'branch') ? `\u00a0\u00a0\u2022\u00a0 ${(commit as GitLogCommit).getDiffStatus()}` : ''}`;
this.description = `${Strings.pad('$(git-commit)', 1, 1)} ${commit.shortSha}`;
this.detail = `${GlyphChars.Space} ${commit.author}, ${moment(commit.date).fromNow()}${(commit.type === 'branch') ? ` ${Strings.pad(GlyphChars.Dot, 1, 1)} ${(commit as GitLogCommit).getDiffStatus()}` : ''}`;
}
}
}

View File

@@ -1,8 +1,9 @@
'use strict';
import { Arrays, Iterables } from '../system';
import { Arrays, Iterables, Strings } from '../system';
import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, ShowQuickCurrentBranchHistoryCommandArgs, ShowQuickFileHistoryCommandArgs } from '../commands';
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './common';
import { GlyphChars } from '../constants';
import { GitLog, GitService, GitUri, RemoteResource } from '../gitService';
import { Keyboard, KeyNoopCommand } from '../keyboard';
import { OpenRemotesCommandQuickPickItem } from './remotes';
@@ -11,7 +12,7 @@ import * as path from 'path';
export class FileHistoryQuickPick {
static showProgress(uri: GitUri) {
return showQuickPickProgress(`${uri.getFormattedPath()}${uri.sha ? ` \u00a0\u2022\u00a0 ${uri.shortSha}` : ''}`,
return showQuickPickProgress(`${uri.getFormattedPath()}${uri.sha ? ` ${Strings.pad(GlyphChars.Dot, 1, 1)} ${uri.shortSha}` : ''}`,
{
left: KeyNoopCommand,
',': KeyNoopCommand,
@@ -30,7 +31,7 @@ export class FileHistoryQuickPick {
index++;
items.splice(0, 0, new CommandQuickPickItem({
label: `$(sync) Show All Commits`,
description: `\u00a0 \u2014 \u00a0\u00a0 this may take a while`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} this may take a while`
}, Commands.ShowQuickFileHistory, [
Uri.file(uri.fsPath),
{
@@ -45,13 +46,13 @@ export class FileHistoryQuickPick {
index++;
items.splice(0, 0, new CommandQuickPickItem({
label: `$(history) Show File History`,
description: `\u00a0 \u2014 \u00a0\u00a0 of ${path.basename(workingFileName)}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} of ${path.basename(workingFileName)}`
}, Commands.ShowQuickFileHistory, [
Uri.file(path.resolve(log.repoPath, workingFileName)),
{
goBackCommand: new CommandQuickPickItem({
label: `go back \u21A9`,
description: `\u00a0 \u2014 \u00a0\u00a0 to history of \u00a0$(file-text) ${path.basename(uri.fsPath)}${uri.sha ? ` from \u00a0$(git-commit) ${uri.shortSha}` : ''}`
label: `go back ${GlyphChars.ArrowBack}`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} to history of ${GlyphChars.Space}$(file-text) ${path.basename(uri.fsPath)}${uri.sha ? ` from ${GlyphChars.Space}$(git-commit) ${uri.shortSha}` : ''}`
}, Commands.ShowQuickFileHistory, [
uri,
{
@@ -74,7 +75,7 @@ export class FileHistoryQuickPick {
if (log.truncated) {
const npc = new CommandQuickPickItem({
label: `$(arrow-right) Show Next Commits`,
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} newer commits`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} shows ${log.maxCount} newer commits`
}, Commands.ShowQuickFileHistory, [
uri,
{
@@ -88,7 +89,7 @@ export class FileHistoryQuickPick {
if (last != null) {
previousPageCommand = new CommandQuickPickItem({
label: `$(arrow-left) Show Previous Commits`,
description: `\u00a0 \u2014 \u00a0\u00a0 shows ${log.maxCount} older commits`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} shows ${log.maxCount} older commits`
}, Commands.ShowQuickFileHistory, [
new GitUri(uri, last),
{
@@ -107,8 +108,8 @@ export class FileHistoryQuickPick {
const branch = await git.getBranch(uri.repoPath!);
const currentCommand = new CommandQuickPickItem({
label: `go back \u21A9`,
description: `\u00a0 \u2014 \u00a0\u00a0 to history of \u00a0$(file-text) ${path.basename(uri.fsPath)}${uri.sha ? ` from \u00a0$(git-commit) ${uri.shortSha}` : ''}`
label: `go back ${GlyphChars.ArrowBack}`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} to history of ${GlyphChars.Space}$(file-text) ${path.basename(uri.fsPath)}${uri.sha ? ` from ${GlyphChars.Space}$(git-commit) ${uri.shortSha}` : ''}`
}, Commands.ShowQuickFileHistory, [
uri,
{
@@ -122,7 +123,7 @@ export class FileHistoryQuickPick {
if (goBackCommand === undefined) {
items.splice(index++, 0, new CommandQuickPickItem({
label: `$(history) Show Branch History`,
description: `\u00a0 \u2014 \u00a0\u00a0 shows \u00a0$(git-branch) ${branch!.name} history`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} shows ${GlyphChars.Space}$(git-branch) ${branch!.name} history`
}, Commands.ShowQuickCurrentBranchHistory,
[
undefined,
@@ -161,7 +162,7 @@ export class FileHistoryQuickPick {
const pick = await window.showQuickPick(items, {
matchOnDescription: true,
matchOnDetail: true,
placeHolder: `${commit.getFormattedPath()}${uri.sha ? ` \u00a0\u2022\u00a0 ${uri.shortSha}` : ''}`,
placeHolder: `${commit.getFormattedPath()}${uri.sha ? ` ${Strings.pad(GlyphChars.Dot, 1, 1)} ${uri.shortSha}` : ''}`,
ignoreFocusOut: getQuickPickIgnoreFocusOut()
// onDidSelectItem: (item: QuickPickItem) => {
// scope.setKeyCommand('right', item);

View File

@@ -1,7 +1,9 @@
'use strict';
import { Strings } from '../system';
import { QuickPickOptions, window } from 'vscode';
import { Commands, OpenInRemoteCommandArgs } from '../commands';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut } from './common';
import { GlyphChars } from '../constants';
import { getNameFromRemoteResource, GitLogCommit, GitRemote, RemoteResource } from '../gitService';
import * as path from 'path';
@@ -13,7 +15,7 @@ export class OpenRemoteCommandQuickPickItem extends CommandQuickPickItem {
constructor(remote: GitRemote, resource: RemoteResource) {
super({
label: `$(link-external) Open ${getNameFromRemoteResource(resource)} in ${remote.provider!.name}`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(repo) ${remote.provider!.path}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(repo) ${remote.provider!.path}`
}, undefined, undefined);
this.remote = remote;
@@ -45,16 +47,16 @@ export class OpenRemotesCommandQuickPickItem extends CommandQuickPickItem {
if (resource.commit !== undefined && resource.commit instanceof GitLogCommit) {
if (resource.commit.status === 'D') {
resource.sha = resource.commit.previousSha;
description = `$(file-text) ${path.basename(resource.fileName)} in \u00a0$(git-commit) ${resource.commit.previousShortSha} (deleted in \u00a0$(git-commit) ${resource.commit.shortSha})`;
description = `$(file-text) ${path.basename(resource.fileName)} in ${GlyphChars.Space}$(git-commit) ${resource.commit.previousShortSha} (deleted in ${GlyphChars.Space}$(git-commit) ${resource.commit.shortSha})`;
}
else {
resource.sha = resource.commit.sha;
description = `$(file-text) ${path.basename(resource.fileName)} in \u00a0$(git-commit) ${resource.commit.shortSha}`;
description = `$(file-text) ${path.basename(resource.fileName)} in ${GlyphChars.Space}$(git-commit) ${resource.commit.shortSha}`;
}
}
else {
const shortFileSha = resource.sha === undefined ? '' : resource.sha.substring(0, 8);
description = `$(file-text) ${path.basename(resource.fileName)}${shortFileSha ? ` in \u00a0$(git-commit) ${shortFileSha}` : ''}`;
description = `$(file-text) ${path.basename(resource.fileName)}${shortFileSha ? ` in ${GlyphChars.Space}$(git-commit) ${shortFileSha}` : ''}`;
}
break;
@@ -71,7 +73,7 @@ export class OpenRemotesCommandQuickPickItem extends CommandQuickPickItem {
if (remotes.length === 1) {
super({
label: `$(link-external) Open ${name} in ${remote.provider!.name}`,
description: `\u00a0 \u2014 \u00a0\u00a0 $(repo) ${remote.provider!.path} \u00a0\u2022\u00a0 ${description}`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(repo) ${remote.provider!.path} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${description}`
}, Commands.OpenInRemote, [
undefined,
{
@@ -89,8 +91,8 @@ export class OpenRemotesCommandQuickPickItem extends CommandQuickPickItem {
: 'Remote';
super({
label: `$(link-external) Open ${name} in ${provider}\u2026`,
description: `\u00a0 \u2014 \u00a0\u00a0 ${description}`
label: `$(link-external) Open ${name} in ${provider}${GlyphChars.Ellipsis}`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} ${description}`
}, Commands.OpenInRemote, [
undefined,
{

View File

@@ -1,8 +1,9 @@
'use strict';
import { Iterables } from '../system';
import { Iterables, Strings } from '../system';
import { commands, QuickPickOptions, TextDocumentShowOptions, Uri, window } from 'vscode';
import { Commands, DiffWithWorkingCommandArgs, OpenChangedFilesCommandArgs, ShowQuickBranchHistoryCommandArgs, ShowQuickRepoStatusCommandArgs, ShowQuickStashListCommandArgs } from '../commands';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, OpenFileCommandQuickPickItem, QuickPickItem } from './common';
import { GlyphChars } from '../constants';
import { GitStatus, GitStatusFile, GitUri } from '../gitService';
import { Keyboard, Keys } from '../keyboard';
import * as path from 'path';
@@ -14,7 +15,7 @@ export class OpenStatusFileCommandQuickPickItem extends OpenFileCommandQuickPick
const description = status.getFormattedDirectory(true);
super(status.Uri, item || {
label: `${status.staged ? '$(check)' : '\u00a0\u00a0\u00a0'}\u00a0\u00a0${icon}\u00a0\u00a0\u00a0${path.basename(status.fileName)}`,
label: `${status.staged ? '$(check)' : GlyphChars.Space.repeat(3)}${Strings.pad(icon, 2, 2)} ${path.basename(status.fileName)}`,
description: description
});
}
@@ -79,8 +80,8 @@ export class RepoStatusQuickPick {
const items = Array.from(Iterables.map(files, s => new OpenStatusFileCommandQuickPickItem(s))) as (OpenStatusFileCommandQuickPickItem | OpenStatusFilesCommandQuickPickItem | CommandQuickPickItem)[];
const currentCommand = new CommandQuickPickItem({
label: `go back \u21A9`,
description: `\u00a0 \u2014 \u00a0\u00a0 to \u00a0$(git-branch) ${status.branch} status`
label: `go back ${GlyphChars.ArrowBack}`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} to ${GlyphChars.Space}$(git-branch) ${status.branch} status`
}, Commands.ShowQuickRepoStatus, [
undefined,
{
@@ -103,12 +104,12 @@ export class RepoStatusQuickPick {
]));
items.splice(unstagedIndex, 0, new OpenStatusFilesCommandQuickPickItem(files.filter(_ => _.status !== 'D' && _.staged), {
label: `\u00a0\u00a0\u00a0\u00a0 $(file-symlink-file) Open Staged Files`,
label: `${GlyphChars.Space.repeat(4)} $(file-symlink-file) Open Staged Files`,
description: ''
}));
items.push(new OpenStatusFilesCommandQuickPickItem(files.filter(_ => _.status !== 'D' && !_.staged), {
label: `\u00a0\u00a0\u00a0\u00a0 $(file-symlink-file) Open Unstaged Files`,
label: `${GlyphChars.Space.repeat(4)} $(file-symlink-file) Open Unstaged Files`,
description: ''
}));
}
@@ -156,7 +157,7 @@ export class RepoStatusQuickPick {
items.splice(0, 0, new CommandQuickPickItem({
label: `$(repo) Show Stashed Changes`,
description: `\u00a0 \u2014 \u00a0\u00a0 shows stashed changes in the repository`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} shows stashed changes in the repository`
}, Commands.ShowQuickStashList, [
new GitUri(Uri.file(status.repoPath), { fileName: '', repoPath: status.repoPath }),
{
@@ -166,8 +167,8 @@ export class RepoStatusQuickPick {
if (status.upstream && status.state.ahead) {
items.splice(0, 0, new CommandQuickPickItem({
label: `$(cloud-upload)\u00a0 ${status.state.ahead} Commit${status.state.ahead > 1 ? 's' : ''} ahead of \u00a0$(git-branch) ${status.upstream}`,
description: `\u00a0 \u2014 \u00a0\u00a0 shows commits in \u00a0$(git-branch) ${status.branch} but not \u00a0$(git-branch) ${status.upstream}`
label: `$(cloud-upload)${GlyphChars.Space} ${status.state.ahead} Commit${status.state.ahead > 1 ? 's' : ''} ahead of ${GlyphChars.Space}$(git-branch) ${status.upstream}`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} shows commits in ${GlyphChars.Space}$(git-branch) ${status.branch} but not ${GlyphChars.Space}$(git-branch) ${status.upstream}`
}, Commands.ShowQuickBranchHistory, [
new GitUri(Uri.file(status.repoPath), { fileName: '', repoPath: status.repoPath, sha: `${status.upstream}..${status.branch}` }),
{
@@ -180,8 +181,8 @@ export class RepoStatusQuickPick {
if (status.upstream && status.state.behind) {
items.splice(0, 0, new CommandQuickPickItem({
label: `$(cloud-download)\u00a0 ${status.state.behind} Commit${status.state.behind > 1 ? 's' : ''} behind \u00a0$(git-branch) ${status.upstream}`,
description: `\u00a0 \u2014 \u00a0\u00a0 shows commits in \u00a0$(git-branch) ${status.upstream} but not \u00a0$(git-branch) ${status.branch}${status.sha ? ` (since \u00a0$(git-commit) ${status.sha.substring(0, 8)})` : ''}`
label: `$(cloud-download)${GlyphChars.Space} ${status.state.behind} Commit${status.state.behind > 1 ? 's' : ''} behind ${GlyphChars.Space}$(git-branch) ${status.upstream}`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} shows commits in ${GlyphChars.Space}$(git-branch) ${status.upstream} but not ${GlyphChars.Space}$(git-branch) ${status.branch}${status.sha ? ` (since ${GlyphChars.Space}$(git-commit) ${status.sha.substring(0, 8)})` : ''}`
}, Commands.ShowQuickBranchHistory, [
new GitUri(Uri.file(status.repoPath), { fileName: '', repoPath: status.repoPath, sha: `${status.branch}..${status.upstream}` }),
{
@@ -194,7 +195,7 @@ export class RepoStatusQuickPick {
if (status.upstream && !status.state.ahead && !status.state.behind) {
items.splice(0, 0, new CommandQuickPickItem({
label: `$(git-branch) ${status.branch} is up-to-date with \u00a0$(git-branch) ${status.upstream}`,
label: `$(git-branch) ${status.branch} is up-to-date with ${GlyphChars.Space}$(git-branch) ${status.upstream}`,
description: ''
}, Commands.ShowQuickRepoStatus, [
undefined,
@@ -212,7 +213,7 @@ export class RepoStatusQuickPick {
const pick = await window.showQuickPick(items, {
matchOnDescription: true,
placeHolder: `status of ${status.branch}${status.upstream ? ` \u00a0\u2194\u00a0 ${status.upstream}` : ''}`,
placeHolder: `status of ${status.branch}${status.upstream ? ` ${Strings.pad(GlyphChars.ArrowLeftRight, 1, 1)} ${status.upstream}` : ''}`,
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
onDidSelectItem: (item: QuickPickItem) => {
scope.setKeyCommand('right', item);

View File

@@ -1,7 +1,8 @@
'use strict';
import { Iterables } from '../system';
import { Iterables, Strings } from '../system';
import { QuickPickOptions, window } from 'vscode';
import { Commands, StashSaveCommandArgs } from '../commands';
import { GlyphChars } from '../constants';
import { GitService, GitStash } from '../gitService';
import { Keyboard } from '../keyboard';
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut } from '../quickPicks';
@@ -14,7 +15,7 @@ export class StashListQuickPick {
if (mode === 'list') {
items.splice(0, 0, new CommandQuickPickItem({
label: `$(repo-push) Stash Unstaged Changes`,
description: `\u00a0 \u2014 \u00a0\u00a0 stashes only unstaged changes`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} stashes only unstaged changes`
}, Commands.StashSave, [
{
unstagedOnly: true,
@@ -24,7 +25,7 @@ export class StashListQuickPick {
items.splice(0, 0, new CommandQuickPickItem({
label: `$(repo-force-push) Stash Changes`,
description: `\u00a0 \u2014 \u00a0\u00a0 stashes all changes`
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} stashes all changes`
}, Commands.StashSave, [
{
unstagedOnly: false,
@@ -42,8 +43,8 @@ export class StashListQuickPick {
const pick = await window.showQuickPick(items, {
matchOnDescription: true,
placeHolder: mode === 'apply'
? `Apply stashed changes to your working tree\u2026`
: `stashed changes \u2014 search by message, filename, or commit id`,
? `Apply stashed changes to your working tree${GlyphChars.Ellipsis}`
: `stashed changes ${GlyphChars.Dash} search by message, filename, or commit id`,
ignoreFocusOut: getQuickPickIgnoreFocusOut()
// onDidSelectItem: (item: QuickPickItem) => {
// scope.setKeyCommand('right', item);