Przeglądaj źródła

Replaces encoded chars with unicode (stops fighting with npm)

Preserves spaces in format strings
main
Eric Amodio 6 lat temu
rodzic
commit
0bbf600b79
2 zmienionych plików z 9 dodań i 5 usunięć
  1. +5
    -5
      package.json
  2. +4
    -0
      src/git/formatters/formatter.ts

+ 5
- 5
package.json Wyświetl plik

@ -1,7 +1,7 @@
{
"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",
"author": {
"name": "Eric Amodio",
@ -339,7 +339,7 @@
},
"gitlens.currentLine.format": {
"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",
"scope": "window"
},
@ -399,7 +399,7 @@
},
"gitlens.explorers.commitFormat": {
"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",
"scope": "window"
},
@ -627,7 +627,7 @@
"chorded",
"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"
},
"gitlens.menus": {

+ 4
- 0
src/git/formatters/formatter.ts Wyświetl plik

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

Ładowanie…
Anuluj
Zapisz