mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-15 01:25:42 -05:00
Changes to use enum for glyphs
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { Strings } from '../system';
|
||||
import { DecorationInstanceRenderOptions, DecorationOptions, ThemableDecorationRenderOptions } from 'vscode';
|
||||
import { IThemeConfig, themeDefaults } from '../configuration';
|
||||
import { GlyphChars } from '../constants';
|
||||
import { CommitFormatter, GitCommit, GitDiffLine, GitService, GitUri, ICommitFormatOptions } from '../gitService';
|
||||
import * as moment from 'moment';
|
||||
|
||||
@@ -56,7 +58,7 @@ export class Annotations {
|
||||
// Escape markdown
|
||||
.replace(escapeMarkdownRegEx, '\\$&')
|
||||
// Escape markdown header (since the above regex won't match it)
|
||||
.replace(/^===/gm, '\u200b===')
|
||||
.replace(/^===/gm, `${GlyphChars.ZeroWidthSpace}===`)
|
||||
// Keep under the same block-quote
|
||||
.replace(/\n/g, ' \n');
|
||||
message = `\n\n> ${message}`;
|
||||
@@ -69,8 +71,8 @@ export class Annotations {
|
||||
|
||||
const codeDiff = this._getCodeDiff(previous, current);
|
||||
return commit.isUncommitted
|
||||
? `\`Changes\` \u2014 _uncommitted_\n${codeDiff}`
|
||||
: `\`Changes\` \u2014 \`${commit.previousShortSha}\` \u2194 \`${commit.shortSha}\`\n${codeDiff}`;
|
||||
? `\`Changes\` ${GlyphChars.Dash} _uncommitted_\n${codeDiff}`
|
||||
: `\`Changes\` ${GlyphChars.Dash} \`${commit.previousShortSha}\` ${GlyphChars.ArrowLeftRight} \`${commit.shortSha}\`\n${codeDiff}`;
|
||||
}
|
||||
|
||||
private static _getCodeDiff(previous: GitDiffLine | undefined, current: GitDiffLine | undefined): string {
|
||||
@@ -104,9 +106,9 @@ export class Annotations {
|
||||
}
|
||||
|
||||
static gutter(commit: GitCommit, format: string, dateFormatOrFormatOptions: string | null | ICommitFormatOptions, renderOptions: IRenderOptions, compact: boolean): DecorationOptions {
|
||||
let content = `\u00a0${CommitFormatter.fromTemplate(format, commit, dateFormatOrFormatOptions)}\u00a0`;
|
||||
let content = Strings.pad(CommitFormatter.fromTemplate(format, commit, dateFormatOrFormatOptions), 1, 1);
|
||||
if (compact) {
|
||||
content = '\u00a0'.repeat(content.length);
|
||||
content = GlyphChars.Space.repeat(content.length);
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -178,7 +180,7 @@ export class Annotations {
|
||||
before: {
|
||||
borderStyle: 'solid',
|
||||
borderWidth: '0 0 0 2px',
|
||||
contentText: '\u200B',
|
||||
contentText: GlyphChars.ZeroWidthSpace,
|
||||
height: cfgTheme.annotations.file.hover.separateLines ? 'calc(100% - 1px)' : '100%',
|
||||
margin: '0 26px 0 0',
|
||||
textDecoration: 'none'
|
||||
@@ -191,7 +193,7 @@ export class Annotations {
|
||||
return {
|
||||
renderOptions: {
|
||||
after: {
|
||||
contentText: `\u00a0${message}\u00a0`
|
||||
contentText: Strings.pad(message, 1, 1)
|
||||
},
|
||||
dark: {
|
||||
after: {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { Iterables } from '../system';
|
||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands, getCommandUri } from './common';
|
||||
import { BuiltInCommands } from '../constants';
|
||||
import { BuiltInCommands, GlyphChars } from '../constants';
|
||||
import { GitService } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { Messages } from '../messages';
|
||||
@@ -39,7 +39,7 @@ export class DiffDirectoryCommand extends ActiveEditorCommand {
|
||||
const current = Iterables.find(branches, _ => _.current);
|
||||
if (current == null) return window.showWarningMessage(`Unable to open directory compare`);
|
||||
|
||||
const pick = await BranchesQuickPick.show(branches, `Compare ${current.name} to \u2026`);
|
||||
const pick = await BranchesQuickPick.show(branches, `Compare ${current.name} to ${GlyphChars.Ellipsis}`);
|
||||
if (pick === undefined) return undefined;
|
||||
|
||||
if (pick instanceof CommandQuickPickItem) return pick.execute();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { commands, TextDocumentShowOptions, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands, getCommandUri } from './common';
|
||||
import { BuiltInCommands } from '../constants';
|
||||
import { BuiltInCommands, GlyphChars } from '../constants';
|
||||
import { DiffWithPreviousCommandArgs } from './diffWithPrevious';
|
||||
import { DiffWithWorkingCommandArgs } from './diffWithWorking';
|
||||
import { GitCommit, GitService, GitUri } from '../gitService';
|
||||
@@ -76,7 +76,7 @@ export class DiffLineWithPreviousCommand extends ActiveEditorCommand {
|
||||
await commands.executeCommand(BuiltInCommands.Diff,
|
||||
Uri.file(lhs),
|
||||
Uri.file(rhs),
|
||||
`${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha}) \u2194 ${path.basename(gitUri.fsPath)} (${gitUri.shortSha})`,
|
||||
`${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha}) ${GlyphChars.ArrowLeftRight} ${path.basename(gitUri.fsPath)} (${gitUri.shortSha})`,
|
||||
args.showOptions);
|
||||
|
||||
// TODO: Figure out how to focus the left pane
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { commands, TextDocumentShowOptions, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands, getCommandUri } from './common';
|
||||
import { BuiltInCommands } from '../constants';
|
||||
import { BuiltInCommands, GlyphChars } from '../constants';
|
||||
import { GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { Messages } from '../messages';
|
||||
@@ -31,7 +31,7 @@ export class DiffWithBranchCommand extends ActiveEditorCommand {
|
||||
if (!gitUri.repoPath) return Messages.showNoRepositoryWarningMessage(`Unable to open branch compare`);
|
||||
|
||||
const branches = await this.git.getBranches(gitUri.repoPath);
|
||||
const pick = await BranchesQuickPick.show(branches, `Compare ${path.basename(gitUri.fsPath)} to \u2026`, args.goBackCommand);
|
||||
const pick = await BranchesQuickPick.show(branches, `Compare ${path.basename(gitUri.fsPath)} to ${GlyphChars.Ellipsis}`, args.goBackCommand);
|
||||
if (pick === undefined) return undefined;
|
||||
|
||||
if (pick instanceof CommandQuickPickItem) return pick.execute();
|
||||
@@ -45,7 +45,7 @@ export class DiffWithBranchCommand extends ActiveEditorCommand {
|
||||
await commands.executeCommand(BuiltInCommands.Diff,
|
||||
Uri.file(compare),
|
||||
gitUri.fileUri(),
|
||||
`${path.basename(gitUri.fsPath)} (${branch}) \u2194 ${path.basename(gitUri.fsPath)}`,
|
||||
`${path.basename(gitUri.fsPath)} (${branch}) ${GlyphChars.ArrowLeftRight} ${path.basename(gitUri.fsPath)}`,
|
||||
args.showOptions);
|
||||
|
||||
// TODO: Figure out how to focus the left pane
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { Iterables } from '../system';
|
||||
import { commands, Range, TextDocumentShowOptions, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands, getCommandUri } from './common';
|
||||
import { BuiltInCommands } from '../constants';
|
||||
import { BuiltInCommands, GlyphChars } from '../constants';
|
||||
import { GitLogCommit, GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { Messages } from '../messages';
|
||||
@@ -60,7 +60,7 @@ export class DiffWithNextCommand extends ActiveEditorCommand {
|
||||
await commands.executeCommand(BuiltInCommands.Diff,
|
||||
Uri.file(lhs),
|
||||
Uri.file(rhs),
|
||||
`${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha}) \u2194 ${path.basename(args.commit.nextUri.fsPath)} (${args.commit.nextShortSha})`,
|
||||
`${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha}) ${GlyphChars.ArrowLeftRight} ${path.basename(args.commit.nextUri.fsPath)} (${args.commit.nextShortSha})`,
|
||||
args.showOptions);
|
||||
|
||||
// TODO: Figure out how to focus the left pane
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { Iterables } from '../system';
|
||||
import { commands, Range, TextDocumentShowOptions, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands, getCommandUri } from './common';
|
||||
import { BuiltInCommands } from '../constants';
|
||||
import { BuiltInCommands, GlyphChars } from '../constants';
|
||||
import { DiffWithWorkingCommandArgs } from './diffWithWorking';
|
||||
import { GitCommit, GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
@@ -59,7 +59,7 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand {
|
||||
await commands.executeCommand(BuiltInCommands.Diff,
|
||||
Uri.file(lhs),
|
||||
Uri.file(rhs),
|
||||
`${path.basename(args.commit.previousUri.fsPath)} (${args.commit.previousShortSha}) \u2194 ${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha})`,
|
||||
`${path.basename(args.commit.previousUri.fsPath)} (${args.commit.previousShortSha}) ${GlyphChars.ArrowLeftRight} ${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha})`,
|
||||
args.showOptions);
|
||||
|
||||
// TODO: Figure out how to focus the left pane
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { commands, TextDocumentShowOptions, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands, getCommandUri } from './common';
|
||||
import { BuiltInCommands } from '../constants';
|
||||
import { BuiltInCommands, GlyphChars } from '../constants';
|
||||
import { GitCommit, GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { Messages } from '../messages';
|
||||
@@ -51,7 +51,7 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand {
|
||||
await commands.executeCommand(BuiltInCommands.Diff,
|
||||
Uri.file(compare),
|
||||
Uri.file(path.resolve(gitUri.repoPath, workingFileName)),
|
||||
`${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha}) \u2194 ${path.basename(workingFileName)}`,
|
||||
`${path.basename(args.commit.uri.fsPath)} (${args.commit.shortSha}) ${GlyphChars.ArrowLeftRight} ${path.basename(workingFileName)}`,
|
||||
args.showOptions);
|
||||
|
||||
// TODO: Figure out how to focus the left pane
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { Arrays } from '../system';
|
||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands, getCommandUri } from './common';
|
||||
import { GlyphChars } from '../constants';
|
||||
import { GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { BranchesQuickPick, CommandQuickPickItem } from '../quickPicks';
|
||||
@@ -29,7 +30,7 @@ export class OpenBranchInRemoteCommand extends ActiveEditorCommand {
|
||||
if (args.branch === undefined) {
|
||||
const branches = await this.git.getBranches(repoPath);
|
||||
|
||||
const pick = await BranchesQuickPick.show(branches, `Show history for branch\u2026`);
|
||||
const pick = await BranchesQuickPick.show(branches, `Show history for branch${GlyphChars.Ellipsis}`);
|
||||
if (pick === undefined) return undefined;
|
||||
|
||||
if (pick instanceof CommandQuickPickItem) return undefined;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
import { Strings } from '../system';
|
||||
import { TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands, getCommandUri } from './common';
|
||||
import { GlyphChars } from '../constants';
|
||||
import { GitLogCommit, GitRemote, RemoteResource } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem, OpenRemoteCommandQuickPickItem, RemotesQuickPick } from '../quickPicks';
|
||||
@@ -42,35 +44,35 @@ export class OpenInRemoteCommand extends ActiveEditorCommand {
|
||||
args.remotes = [remote];
|
||||
}
|
||||
}
|
||||
placeHolder = `open ${args.resource.branch} branch in\u2026`;
|
||||
placeHolder = `open ${args.resource.branch} branch in${GlyphChars.Ellipsis}`;
|
||||
break;
|
||||
|
||||
case 'commit':
|
||||
const shortSha = args.resource.sha.substring(0, 8);
|
||||
placeHolder = `open commit ${shortSha} in\u2026`;
|
||||
placeHolder = `open commit ${shortSha} in${GlyphChars.Ellipsis}`;
|
||||
break;
|
||||
|
||||
case 'file':
|
||||
if (args.resource.commit !== undefined && args.resource.commit instanceof GitLogCommit) {
|
||||
if (args.resource.commit.status === 'D') {
|
||||
args.resource.sha = args.resource.commit.previousSha;
|
||||
placeHolder = `open ${args.resource.fileName} \u00a0\u2022\u00a0 ${args.resource.commit.previousShortSha} in\u2026`;
|
||||
placeHolder = `open ${args.resource.fileName} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${args.resource.commit.previousShortSha} in${GlyphChars.Ellipsis}`;
|
||||
}
|
||||
else {
|
||||
args.resource.sha = args.resource.commit.sha;
|
||||
placeHolder = `open ${args.resource.fileName} \u00a0\u2022\u00a0 ${args.resource.commit.shortSha} in\u2026`;
|
||||
placeHolder = `open ${args.resource.fileName} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${args.resource.commit.shortSha} in${GlyphChars.Ellipsis}`;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const shortFileSha = args.resource.sha === undefined ? '' : args.resource.sha.substring(0, 8);
|
||||
const shaSuffix = shortFileSha ? ` \u00a0\u2022\u00a0 ${shortFileSha}` : '';
|
||||
const shaSuffix = shortFileSha ? ` ${Strings.pad(GlyphChars.Dot, 1, 1)} ${shortFileSha}` : '';
|
||||
|
||||
placeHolder = `open ${args.resource.fileName}${shaSuffix} in\u2026`;
|
||||
placeHolder = `open ${args.resource.fileName}${shaSuffix} in${GlyphChars.Ellipsis}`;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'working-file':
|
||||
placeHolder = `open ${args.resource.fileName} in\u2026`;
|
||||
placeHolder = `open ${args.resource.fileName} in${GlyphChars.Ellipsis}`;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
import { Strings } from '../system';
|
||||
import { commands, InputBoxOptions, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCachedCommand, Commands, getCommandUri } from './common';
|
||||
import { GlyphChars } from '../constants';
|
||||
import { GitRepoSearchBy, GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { Messages } from '../messages';
|
||||
@@ -109,8 +111,8 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
|
||||
|
||||
// Create a command to get back to here
|
||||
const currentCommand = new CommandQuickPickItem({
|
||||
label: `go back \u21A9`,
|
||||
description: `\u00a0 \u2014 \u00a0\u00a0 to commit search`
|
||||
label: `go back ${GlyphChars.ArrowBack}`,
|
||||
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} to commit search`
|
||||
}, Commands.ShowCommitSearch, [
|
||||
uri,
|
||||
{
|
||||
@@ -130,8 +132,8 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
|
||||
sha: pick.commit.sha,
|
||||
commit: pick.commit,
|
||||
goBackCommand: new CommandQuickPickItem({
|
||||
label: `go back \u21A9`,
|
||||
description: `\u00a0 \u2014 \u00a0\u00a0 to search for ${placeHolder}`
|
||||
label: `go back ${GlyphChars.ArrowBack}`,
|
||||
description: `${Strings.pad(GlyphChars.Dash, 2, 2)} to search for ${placeHolder}`
|
||||
}, Commands.ShowCommitSearch, [
|
||||
uri,
|
||||
args
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
import { Strings } from '../system';
|
||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCachedCommand, Commands, getCommandUri } from './common';
|
||||
import { GlyphChars } from '../constants';
|
||||
import { GitLog, GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { Messages } from '../messages';
|
||||
@@ -39,7 +41,7 @@ export class ShowQuickBranchHistoryCommand extends ActiveEditorCachedCommand {
|
||||
if (args.branch === undefined) {
|
||||
const branches = await this.git.getBranches(repoPath);
|
||||
|
||||
const pick = await BranchesQuickPick.show(branches, `Show history for branch\u2026`);
|
||||
const pick = await BranchesQuickPick.show(branches, `Show history for branch${GlyphChars.Ellipsis}`);
|
||||
if (pick === undefined) return undefined;
|
||||
|
||||
if (pick instanceof CommandQuickPickItem) return pick.execute();
|
||||
@@ -64,8 +66,8 @@ export class ShowQuickBranchHistoryCommand extends ActiveEditorCachedCommand {
|
||||
|
||||
// Create a command to get back to here
|
||||
const currentCommand = new CommandQuickPickItem({
|
||||
label: `go back \u21A9`,
|
||||
description: `\u00a0 \u2014 \u00a0\u00a0 to \u00a0$(git-branch) ${args.branch} history`
|
||||
label: `go back ${GlyphChars.ArrowBack}`,
|
||||
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} to ${GlyphChars.Space}$(git-branch) ${args.branch} history`
|
||||
}, Commands.ShowQuickBranchHistory, [
|
||||
uri,
|
||||
args
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
import { Strings } from '../system';
|
||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCachedCommand, Commands, getCommandUri } from './common';
|
||||
import { GlyphChars } from '../constants';
|
||||
import { GitCommit, GitLog, GitLogCommit, GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem, CommitDetailsQuickPick, CommitWithFileStatusQuickPickItem } from '../quickPicks';
|
||||
@@ -83,8 +85,8 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand {
|
||||
if (args.goBackCommand === undefined) {
|
||||
// Create a command to get back to the branch history
|
||||
args.goBackCommand = new CommandQuickPickItem({
|
||||
label: `go back \u21A9`,
|
||||
description: `\u00a0 \u2014 \u00a0\u00a0 to branch history`
|
||||
label: `go back ${GlyphChars.ArrowBack}`,
|
||||
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} to branch history`
|
||||
}, Commands.ShowQuickCurrentBranchHistory, [
|
||||
new GitUri(args.commit.uri, args.commit)
|
||||
]);
|
||||
@@ -92,8 +94,8 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand {
|
||||
|
||||
// Create a command to get back to where we are right now
|
||||
const currentCommand = new CommandQuickPickItem({
|
||||
label: `go back \u21A9`,
|
||||
description: `\u00a0 \u2014 \u00a0\u00a0 to details of \u00a0$(git-commit) ${args.commit.shortSha}`
|
||||
label: `go back ${GlyphChars.ArrowBack}`,
|
||||
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} to details of ${GlyphChars.Space}$(git-commit) ${args.commit.shortSha}`
|
||||
}, Commands.ShowQuickCommitDetails, [
|
||||
new GitUri(args.commit.uri, args.commit),
|
||||
args
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
import { Strings } from '../system';
|
||||
import { TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCachedCommand, Commands, getCommandUri } from './common';
|
||||
import { GlyphChars } from '../constants';
|
||||
import { GitCommit, GitLog, GitLogCommit, GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem, CommitFileDetailsQuickPick } from '../quickPicks';
|
||||
@@ -85,8 +87,8 @@ export class ShowQuickCommitFileDetailsCommand extends ActiveEditorCachedCommand
|
||||
if (args.goBackCommand === undefined) {
|
||||
// Create a command to get back to the commit details
|
||||
args.goBackCommand = new CommandQuickPickItem({
|
||||
label: `go back \u21A9`,
|
||||
description: `\u00a0 \u2014 \u00a0\u00a0 to details of \u00a0$(git-commit) ${shortSha}`
|
||||
label: `go back ${GlyphChars.ArrowBack}`,
|
||||
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} to details of ${GlyphChars.Space}$(git-commit) ${shortSha}`
|
||||
}, Commands.ShowQuickCommitDetails, [
|
||||
new GitUri(args.commit.uri, args.commit),
|
||||
{
|
||||
@@ -98,8 +100,8 @@ export class ShowQuickCommitFileDetailsCommand extends ActiveEditorCachedCommand
|
||||
|
||||
// Create a command to get back to where we are right now
|
||||
const currentCommand = new CommandQuickPickItem({
|
||||
label: `go back \u21A9`,
|
||||
description: `\u00a0 \u2014 \u00a0\u00a0 to details of \u00a0$(file-text) ${path.basename(args.commit.fileName)} in \u00a0$(git-commit) ${shortSha}`
|
||||
label: `go back ${GlyphChars.ArrowBack}`,
|
||||
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} to details of ${GlyphChars.Space}$(file-text) ${path.basename(args.commit.fileName)} in ${GlyphChars.Space}$(git-commit) ${shortSha}`
|
||||
}, Commands.ShowQuickCommitFileDetails, [
|
||||
new GitUri(args.commit.uri, args.commit),
|
||||
args
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
import { Strings } from '../system';
|
||||
import { commands, Range, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCachedCommand, Commands, getCommandUri } from './common';
|
||||
import { GlyphChars } from '../constants';
|
||||
import { GitLog, GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem, FileHistoryQuickPick } from '../quickPicks';
|
||||
@@ -49,8 +51,8 @@ export class ShowQuickFileHistoryCommand extends ActiveEditorCachedCommand {
|
||||
|
||||
// Create a command to get back to where we are right now
|
||||
const currentCommand = new CommandQuickPickItem({
|
||||
label: `go back \u21A9`,
|
||||
description: `\u00a0 \u2014 \u00a0\u00a0 to history of \u00a0$(file-text) ${path.basename(pick.commit.fileName)}${gitUri.sha ? ` from \u00a0$(git-commit) ${gitUri.shortSha}` : ''}`
|
||||
label: `go back ${GlyphChars.ArrowBack}`,
|
||||
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} to history of ${GlyphChars.Space}$(file-text) ${path.basename(pick.commit.fileName)}${gitUri.sha ? ` from ${GlyphChars.Space}$(git-commit) ${gitUri.shortSha}` : ''}`
|
||||
}, Commands.ShowQuickFileHistory, [
|
||||
uri,
|
||||
args
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
import { Strings } from '../system';
|
||||
import { commands, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCachedCommand, Commands, getCommandUri } from './common';
|
||||
import { GlyphChars } from '../constants';
|
||||
import { GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { Messages } from '../messages';
|
||||
@@ -29,8 +31,8 @@ export class ShowQuickStashListCommand extends ActiveEditorCachedCommand {
|
||||
|
||||
// Create a command to get back to here
|
||||
const currentCommand = new CommandQuickPickItem({
|
||||
label: `go back \u21A9`,
|
||||
description: `\u00a0 \u2014 \u00a0\u00a0 to stashed changes`
|
||||
label: `go back ${GlyphChars.ArrowBack}`,
|
||||
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} to stashed changes`
|
||||
}, Commands.ShowQuickStashList, [
|
||||
uri,
|
||||
{
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
'use strict';
|
||||
import { Strings } from '../system';
|
||||
import { MessageItem, window } from 'vscode';
|
||||
import { GitService, GitStashCommit } from '../gitService';
|
||||
import { Command, Commands } from './common';
|
||||
import { GlyphChars } from '../constants';
|
||||
import { CommitQuickPickItem, StashListQuickPick } from '../quickPicks';
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem } from '../quickPicks';
|
||||
@@ -28,8 +30,8 @@ export class StashApplyCommand extends Command {
|
||||
if (stash === undefined) return window.showInformationMessage(`There are no stashed changes`);
|
||||
|
||||
const currentCommand = new CommandQuickPickItem({
|
||||
label: `go back \u21A9`,
|
||||
description: `\u00a0 \u2014 \u00a0\u00a0 to apply stashed changes`
|
||||
label: `go back ${GlyphChars.ArrowBack}`,
|
||||
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} to apply stashed changes`
|
||||
}, Commands.StashApply, [args]);
|
||||
|
||||
const pick = await StashListQuickPick.show(this.git, stash, 'apply', args.goBackCommand, currentCommand);
|
||||
@@ -41,7 +43,7 @@ export class StashApplyCommand extends Command {
|
||||
|
||||
try {
|
||||
if (args.confirm) {
|
||||
const message = args.stashItem.message.length > 80 ? `${args.stashItem.message.substring(0, 80)}\u2026` : args.stashItem.message;
|
||||
const message = args.stashItem.message.length > 80 ? `${args.stashItem.message.substring(0, 80)}${GlyphChars.Ellipsis}` : args.stashItem.message;
|
||||
const result = await window.showWarningMessage(`Apply stashed changes '${message}' to your working tree?`, { title: 'Yes, delete after applying' } as MessageItem, { title: 'Yes' } as MessageItem, { title: 'No', isCloseAffordance: true } as MessageItem);
|
||||
if (result === undefined || result.title === 'No') return args.goBackCommand === undefined ? undefined : args.goBackCommand.execute();
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
'use strict';
|
||||
import { MessageItem, window } from 'vscode';
|
||||
import { GitService } from '../gitService';
|
||||
import { Command, Commands } from './common';
|
||||
import { GlyphChars } from '../constants';
|
||||
import { GitService } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem } from '../quickPicks';
|
||||
|
||||
@@ -29,7 +30,7 @@ export class StashDeleteCommand extends Command {
|
||||
|
||||
try {
|
||||
if (args.confirm) {
|
||||
const message = args.stashItem.message.length > 80 ? `${args.stashItem.message.substring(0, 80)}\u2026` : args.stashItem.message;
|
||||
const message = args.stashItem.message.length > 80 ? `${args.stashItem.message.substring(0, 80)}${GlyphChars.Ellipsis}` : args.stashItem.message;
|
||||
const result = await window.showWarningMessage(`Delete stashed changes '${message}'?`, { title: 'Yes' } as MessageItem, { title: 'No', isCloseAffordance: true } as MessageItem);
|
||||
if (result === undefined || result.title !== 'Yes') return args.goBackCommand === undefined ? undefined : args.goBackCommand.execute();
|
||||
}
|
||||
|
||||
@@ -67,6 +67,33 @@ export const DocumentSchemes = {
|
||||
GitLensGit: 'gitlens-git' as DocumentSchemes
|
||||
};
|
||||
|
||||
export type GlyphChars = '\u21a9' |
|
||||
'\u2193' |
|
||||
'\u2937' |
|
||||
'\u2190' |
|
||||
'\u2194' |
|
||||
'\u21e8' |
|
||||
'\u2191' |
|
||||
'\u2014' |
|
||||
'\u2022' |
|
||||
'\u2026' |
|
||||
'\u00a0' |
|
||||
'\u200b';
|
||||
export const GlyphChars = {
|
||||
ArrowBack: '\u21a9' as GlyphChars,
|
||||
ArrowDown: '\u2193' as GlyphChars,
|
||||
ArrowDropRight: '\u2937' as GlyphChars,
|
||||
ArrowLeft: '\u2190' as GlyphChars,
|
||||
ArrowLeftRight: '\u2194' as GlyphChars,
|
||||
ArrowRightHollow: '\u21e8' as GlyphChars,
|
||||
ArrowUp: '\u2191' as GlyphChars,
|
||||
Dash: '\u2014' as GlyphChars,
|
||||
Dot: '\u2022' as GlyphChars,
|
||||
Ellipsis: '\u2026' as GlyphChars,
|
||||
Space: '\u00a0' as GlyphChars,
|
||||
ZeroWidthSpace: '\u200b' as GlyphChars
|
||||
};
|
||||
|
||||
export type WorkspaceState = 'gitlensVersion';
|
||||
export const WorkspaceState = {
|
||||
GitLensVersion: 'gitlensVersion' as WorkspaceState
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
import { Strings } from '../system';
|
||||
import { Uri } from 'vscode';
|
||||
import { DocumentSchemes } from '../constants';
|
||||
import { DocumentSchemes, GlyphChars } from '../constants';
|
||||
import { GitService, IGitStatusFile } from '../gitService';
|
||||
import * as path from 'path';
|
||||
|
||||
@@ -62,7 +63,7 @@ export class GitUri extends Uri {
|
||||
return Uri.file(this.sha ? this.path : this.fsPath);
|
||||
}
|
||||
|
||||
getFormattedPath(separator: string = ' \u00a0\u2022\u00a0 '): string {
|
||||
getFormattedPath(separator: string = Strings.pad(GlyphChars.Dot, 2, 2)): string {
|
||||
let directory = path.dirname(this.fsPath);
|
||||
if (this.repoPath) {
|
||||
directory = path.relative(this.repoPath, directory);
|
||||
@@ -108,7 +109,7 @@ export class GitUri extends Uri {
|
||||
return (!directory || directory === '.') ? '' : directory;
|
||||
}
|
||||
|
||||
static getFormattedPath(fileNameOrUri: string | Uri, separator: string = ' \u00a0\u2022\u00a0 '): string {
|
||||
static getFormattedPath(fileNameOrUri: string | Uri, separator: string = Strings.pad(GlyphChars.Dot, 2, 2)): string {
|
||||
let fileName: string;
|
||||
if (fileNameOrUri instanceof Uri) {
|
||||
if (fileNameOrUri instanceof GitUri) return fileNameOrUri.getFormattedPath(separator);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
import { Strings } from '../../system';
|
||||
import { Uri } from 'vscode';
|
||||
import { GlyphChars } from '../../constants';
|
||||
import { Git } from '../git';
|
||||
import { GitUri } from '../gitUri';
|
||||
import * as path from 'path';
|
||||
@@ -22,7 +24,6 @@ export type GitCommitType = 'blame' | 'branch' | 'file' | 'stash';
|
||||
export class GitCommit {
|
||||
|
||||
type: GitCommitType;
|
||||
// lines: GitCommitLine[];
|
||||
originalFileName?: string;
|
||||
previousSha?: string;
|
||||
previousFileName?: string;
|
||||
@@ -37,7 +38,6 @@ export class GitCommit {
|
||||
public author: string,
|
||||
public date: Date,
|
||||
public message: string,
|
||||
// lines?: GitCommitLine[],
|
||||
originalFileName?: string,
|
||||
previousSha?: string,
|
||||
previousFileName?: string
|
||||
@@ -45,7 +45,6 @@ export class GitCommit {
|
||||
this.type = type;
|
||||
this.fileName = this.fileName && this.fileName.replace(/, ?$/, '');
|
||||
|
||||
// this.lines = lines || [];
|
||||
this.originalFileName = originalFileName;
|
||||
this.previousSha = previousSha;
|
||||
this.previousFileName = previousFileName;
|
||||
@@ -74,7 +73,7 @@ export class GitCommit {
|
||||
return Uri.file(path.resolve(this.repoPath, this.originalFileName || this.fileName));
|
||||
}
|
||||
|
||||
getFormattedPath(separator: string = ' \u00a0\u2022\u00a0 '): string {
|
||||
getFormattedPath(separator: string = Strings.pad(GlyphChars.Dot, 2, 2)): string {
|
||||
return GitUri.getFormattedPath(this.fileName, separator);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
import { Strings } from '../../system';
|
||||
import { Uri } from 'vscode';
|
||||
import { GlyphChars } from '../../constants';
|
||||
import { GitUri } from '../gitUri';
|
||||
import * as path from 'path';
|
||||
|
||||
@@ -37,7 +39,7 @@ export class GitStatusFile implements IGitStatusFile {
|
||||
return GitStatusFile.getFormattedDirectory(this, includeOriginal);
|
||||
}
|
||||
|
||||
getFormattedPath(separator: string = ' \u00a0\u2022\u00a0 '): string {
|
||||
getFormattedPath(separator: string = Strings.pad(GlyphChars.Dot, 2, 2)): string {
|
||||
return GitUri.getFormattedPath(this.fileName, separator);
|
||||
}
|
||||
|
||||
@@ -52,7 +54,7 @@ export class GitStatusFile implements IGitStatusFile {
|
||||
static getFormattedDirectory(status: IGitStatusFile, includeOriginal: boolean = false): string {
|
||||
const directory = GitUri.getDirectory(status.fileName);
|
||||
return (includeOriginal && status.status === 'R' && status.originalFileName)
|
||||
? `${directory} \u00a0\u2190\u00a0 ${status.originalFileName}`
|
||||
? `${directory} ${Strings.pad(GlyphChars.ArrowLeft, 1, 1)} ${status.originalFileName}`
|
||||
: directory;
|
||||
}
|
||||
}
|
||||
@@ -68,6 +70,6 @@ const statusOcticonsMap = {
|
||||
U: '$(question)'
|
||||
};
|
||||
|
||||
export function getGitStatusIcon(status: GitStatusFileStatus, missing: string = '\u00a0\u00a0\u00a0\u00a0'): string {
|
||||
export function getGitStatusIcon(status: GitStatusFileStatus, missing: string = GlyphChars.Space.repeat(4)): string {
|
||||
return statusOcticonsMap[status] || missing;
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
import { Iterables, Objects } from './system';
|
||||
import { Disposable, Event, EventEmitter, ExtensionContext, FileSystemWatcher, languages, Location, Position, Range, TextDocument, TextDocumentChangeEvent, TextEditor, Uri, workspace } from 'vscode';
|
||||
import { IConfig } from './configuration';
|
||||
import { CommandContext, DocumentSchemes, ExtensionKey, setCommandContext } from './constants';
|
||||
import { CommandContext, DocumentSchemes, ExtensionKey, GlyphChars, setCommandContext } from './constants';
|
||||
import { Git, GitAuthor, GitBlame, GitBlameCommit, GitBlameLine, GitBlameLines, GitBlameParser, GitBranch, GitCommit, GitDiff, GitDiffLine, GitDiffParser, GitLog, GitLogCommit, GitLogParser, GitRemote, GitStash, GitStashParser, GitStatus, GitStatusFile, GitStatusParser, IGit, setDefaultEncoding } from './git/git';
|
||||
import { GitUri, IGitCommitInfo, IGitUriData } from './git/gitUri';
|
||||
import { GitCodeLensProvider } from './gitCodeLensProvider';
|
||||
@@ -526,7 +526,7 @@ export class GitService extends Disposable {
|
||||
Iterables.forEach(blame.commits.values(), (c, i) => {
|
||||
if (c.isUncommitted) return;
|
||||
|
||||
const decoration = `\u2937 ${c.author}, ${moment(c.date).format(dateFormat)}`;
|
||||
const decoration = `${GlyphChars.ArrowDropRight} ${c.author}, ${moment(c.date).format(dateFormat)}`;
|
||||
const uri = GitService.toReferenceGitContentUri(c, i + 1, commitCount, c.originalFileName, decoration, dateFormat);
|
||||
locations.push(new Location(uri, new Position(0, 0)));
|
||||
if (c.sha === selectedSha) {
|
||||
@@ -864,7 +864,7 @@ export class GitService extends Disposable {
|
||||
Iterables.forEach(log.commits.values(), (c, i) => {
|
||||
if (c.isUncommitted) return;
|
||||
|
||||
const decoration = `\u2937 ${c.author}, ${moment(c.date).format(dateFormat)}`;
|
||||
const decoration = `${GlyphChars.ArrowDropRight} ${c.author}, ${moment(c.date).format(dateFormat)}`;
|
||||
const uri = GitService.toReferenceGitContentUri(c, i + 1, commitCount, c.originalFileName, decoration, dateFormat);
|
||||
locations.push(new Location(uri, new Position(0, 0)));
|
||||
if (c.sha === selectedSha) {
|
||||
@@ -1098,7 +1098,7 @@ export class GitService extends Disposable {
|
||||
|
||||
let message = commit.message;
|
||||
if (message.length > 50) {
|
||||
message = message.substring(0, 49) + '\u2026';
|
||||
message = message.substring(0, 49) + GlyphChars.Ellipsis;
|
||||
}
|
||||
|
||||
if (dateFormat === null) {
|
||||
@@ -1106,7 +1106,7 @@ export class GitService extends Disposable {
|
||||
}
|
||||
|
||||
// NOTE: Need to specify an index here, since I can't control the sort order -- just alphabetic or by file location
|
||||
return Uri.parse(`${scheme}:${pad(data.index || 0)} \u2022 ${encodeURIComponent(message)} \u2022 ${moment(commit.date).format(dateFormat)} \u2022 ${encodeURIComponent(uriPath)}?${JSON.stringify(data)}`);
|
||||
return Uri.parse(`${scheme}:${pad(data.index || 0)} ${GlyphChars.Dot} ${encodeURIComponent(message)} ${GlyphChars.Dot} ${moment(commit.date).format(dateFormat)} ${GlyphChars.Dot} ${encodeURIComponent(uriPath)}?${JSON.stringify(data)}`);
|
||||
}
|
||||
|
||||
private static _toGitUriData<T extends IGitUriData>(commit: IGitUriData, index?: number, originalFileName?: string, decoration?: string): T {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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` : '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()}` : ''}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -56,6 +56,12 @@ export namespace Strings {
|
||||
}
|
||||
}
|
||||
|
||||
export function pad(s: string, before: number = 0, after: number = 0, padding: string = `\u00a0`) {
|
||||
if (before === 0 && after === 0) return s;
|
||||
|
||||
return `${before === 0 ? '' : padding.repeat(before)}${s}${after === 0 ? '' : padding.repeat(after)}`;
|
||||
}
|
||||
|
||||
export function padLeft(s: string, padTo: number, padding: string = '\u00a0') {
|
||||
const diff = padTo - s.length;
|
||||
return (diff <= 0) ? s : '\u00a0'.repeat(diff) + s;
|
||||
|
||||
Reference in New Issue
Block a user