Browse Source

Replaces encoded chars with unicode (stops fighting with npm)

Preserves spaces in format strings
main
Eric Amodio 6 years ago
parent
commit
0bbf600b79
2 changed files with 9 additions and 5 deletions
  1. +5
    -5
      package.json
  2. +4
    -0
      src/git/formatters/formatter.ts

+ 5
- 5
package.json View File

@ -1,7 +1,7 @@
{ {
"name": "gitlens", "name": "gitlens",
"displayName": "GitLens \u2014 Git supercharged",
"description": "Supercharge the Git capabilities built into Visual Studio Code \u2014 Visualize code authorship at a glance via Git blame annotations and code lens, seamlessly navigate and explore Git repositories, gain valuable insights via powerful comparison commands, and so much more",
"displayName": "GitLens Git supercharged",
"description": "Supercharge the Git capabilities built into Visual Studio Code Visualize code authorship at a glance via Git blame annotations and code lens, seamlessly navigate and explore Git repositories, gain valuable insights via powerful comparison commands, and so much more",
"version": "8.5.0", "version": "8.5.0",
"author": { "author": {
"name": "Eric Amodio", "name": "Eric Amodio",
@ -339,7 +339,7 @@
}, },
"gitlens.currentLine.format": { "gitlens.currentLine.format": {
"type": "string", "type": "string",
"default": "${authorAgoOrDate} \u2022 ${message}",
"default": "${authorAgoOrDate} ${message}",
"description": "Specifies the format of the current line blame annotation\nAvailable tokens\n ${id} - commit id\n ${author} - commit author\n ${message} - commit message\n ${ago} - relative commit date (e.g. 1 day ago)\n ${date} - formatted commit date (format specified by `gitlens.currentLine.dateFormat`)\n ${agoOrDate} - commit date specified by `gitlens.defaultDateStyle`\n ${authorAgo} - commit author, relative commit date\n ${authorAgoOrDate} - commit author, commit date specified by `gitlens.defaultDateStyle`\nSee https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting", "description": "Specifies the format of the current line blame annotation\nAvailable tokens\n ${id} - commit id\n ${author} - commit author\n ${message} - commit message\n ${ago} - relative commit date (e.g. 1 day ago)\n ${date} - formatted commit date (format specified by `gitlens.currentLine.dateFormat`)\n ${agoOrDate} - commit date specified by `gitlens.defaultDateStyle`\n ${authorAgo} - commit author, relative commit date\n ${authorAgoOrDate} - commit author, commit date specified by `gitlens.defaultDateStyle`\nSee https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting",
"scope": "window" "scope": "window"
}, },
@ -399,7 +399,7 @@
}, },
"gitlens.explorers.commitFormat": { "gitlens.explorers.commitFormat": {
"type": "string", "type": "string",
"default": "${message} \u00a0\u2022\u00a0 ${authorAgoOrDate} \u00a0 (${id})",
"default": "${message} • ${authorAgoOrDate} (${id})",
"description": "Specifies the format of committed changes in the `GitLens` and `GitLens Results` explorers\nAvailable tokens\n ${id} - commit id\n ${author} - commit author\n ${message} - commit message\n ${ago} - relative commit date (e.g. 1 day ago)\n ${date} - formatted commit date (format specified by `gitlens.defaultDateFormat`)\\n ${agoOrDate} - commit date specified by `gitlens.defaultDateStyle`\n ${authorAgo} - commit author, relative commit date\n ${authorAgoOrDate} - commit author, commit date specified by `gitlens.defaultDateStyle`\nSee https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting", "description": "Specifies the format of committed changes in the `GitLens` and `GitLens Results` explorers\nAvailable tokens\n ${id} - commit id\n ${author} - commit author\n ${message} - commit message\n ${ago} - relative commit date (e.g. 1 day ago)\n ${date} - formatted commit date (format specified by `gitlens.defaultDateFormat`)\\n ${agoOrDate} - commit date specified by `gitlens.defaultDateStyle`\n ${authorAgo} - commit author, relative commit date\n ${authorAgoOrDate} - commit author, commit date specified by `gitlens.defaultDateStyle`\nSee https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting",
"scope": "window" "scope": "window"
}, },
@ -627,7 +627,7 @@
"chorded", "chorded",
"none" "none"
], ],
"description": "Specifies the keymap to use for GitLens shortcut keys\n `alternate` - adds an alternate set of shortcut keys that start with `Alt` (\u2325 on macOS)\n `chorded` - adds a chorded set of shortcut keys that start with `Ctrl+Alt+G` (`\u2325\u2318G` on macOS)\n `none` - no shortcut keys will be added",
"description": "Specifies the keymap to use for GitLens shortcut keys\n `alternate` - adds an alternate set of shortcut keys that start with `Alt` (⌥ on macOS)\n `chorded` - adds a chorded set of shortcut keys that start with `Ctrl+Alt+G` (`⌥⌘G` on macOS)\n `none` - no shortcut keys will be added",
"scope": "window" "scope": "window"
}, },
"gitlens.menus": { "gitlens.menus": {

+ 4
- 0
src/git/formatters/formatter.ts View File

@ -8,6 +8,8 @@ export interface IFormatOptions {
type Constructor<T = {}> = new (...args: any[]) => T; type Constructor<T = {}> = new (...args: any[]) => T;
const spaceReplacementRegex = / /g;
export abstract class Formatter<TItem = any, TOptions extends IFormatOptions = IFormatOptions> { export abstract class Formatter<TItem = any, TOptions extends IFormatOptions = IFormatOptions> {
protected _item!: TItem; protected _item!: TItem;
protected _options!: TOptions; protected _options!: TOptions;
@ -97,6 +99,8 @@ export abstract class Formatter
item: TItem, item: TItem,
dateFormatOrOptions?: string | null | TOptions dateFormatOrOptions?: string | null | TOptions
): string { ): string {
// Preserve spaces
template = template.replace(spaceReplacementRegex, '\u00a0');
if (formatter instanceof Formatter) return Strings.interpolate(template, formatter); if (formatter instanceof Formatter) return Strings.interpolate(template, formatter);
let options: TOptions | undefined = undefined; let options: TOptions | undefined = undefined;

Loading…
Cancel
Save