瀏覽代碼

Replaces encoded chars with unicode (stops fighting with npm)

Preserves spaces in format strings
main
Eric Amodio 6 年之前
父節點
當前提交
0bbf600b79
共有 2 個文件被更改,包括 9 次插入5 次删除
  1. +5
    -5
      package.json
  2. +4
    -0
      src/git/formatters/formatter.ts

+ 5
- 5
package.json 查看文件

@ -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 查看文件

@ -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;

Loading…
取消
儲存