浏览代码

Removes obsolete character settings

main
Eric Amodio 7 年前
父节点
当前提交
e5653d1c66
共有 5 个文件被更改,包括 14 次插入60 次删除
  1. +0
    -20
      package.json
  2. +10
    -27
      src/blameAnnotationFormatter.ts
  3. +4
    -4
      src/blameAnnotationProvider.ts
  4. +0
    -6
      src/configuration.ts
  5. +0
    -3
      src/extension.ts

+ 0
- 20
package.json 查看文件

@ -104,26 +104,6 @@
],
"description": "Specifies whether and how to show blame annotations on the active line. `off` - no annotation. `inline` - adds a trailing annotation to the active line. `hover` - adds hover annotation to the active line. `both` - adds both `inline` and `hover` annotations"
},
"gitlens.blame.annotation.characters.ellipse": {
"type": "string",
"default": "\u2026",
"description": "Specifies the ellipse character to use in blame annotations"
},
"gitlens.blame.annotation.characters.indent": {
"type": "string",
"default": "\u2759",
"description": "Specifies the indent character to use in `compact` blame annotations"
},
"gitlens.blame.annotation.characters.padding": {
"type": "string",
"default": "\u00a0",
"description": "Specifies the padding character (typically a non-breaking space) to use in blame annotations"
},
"gitlens.blame.annotation.characters.separator": {
"type": "string",
"default": "\u2022",
"description": "Specifies the separator character to use in blame annotations"
},
"gitlens.codeLens.visibility": {
"type": "string",
"default": "auto",

+ 10
- 27
src/blameAnnotationFormatter.ts 查看文件

@ -8,23 +8,6 @@ export const defaultRelativeDateLength = 13;
export const defaultAuthorLength = 16;
export const defaultMessageLength = 32;
const defaultCssEllipse = '\u2026';
const defaultCssIndent = '\u2759';
const defaultCssPadding = '\u00a0';
const defaultCssSeparator = '\u2022';
export let cssEllipse = defaultCssEllipse;
export let cssIndent = defaultCssIndent;
export let cssPadding = defaultCssPadding;
export let cssSeparator = defaultCssSeparator;
export function configureCssCharacters(config: IBlameConfig) {
cssEllipse = config.annotation.characters.ellipse || defaultCssEllipse;
cssIndent = config.annotation.characters.indent || defaultCssIndent;
cssPadding = config.annotation.characters.padding || defaultCssSeparator;
cssSeparator = config.annotation.characters.separator || defaultCssSeparator;
}
export enum BlameAnnotationFormat {
Constrained,
Unconstrained
@ -39,10 +22,10 @@ export class BlameAnnotationFormatter {
if (format === BlameAnnotationFormat.Unconstrained) {
const authorAndDate = this.getAuthorAndDate(config, commit, config.annotation.dateFormat || 'MMMM Do, YYYY h:MMa');
if (config.annotation.sha) {
message = `${sha}${(authorAndDate ? `${cssPadding}${cssSeparator}${cssPadding}${authorAndDate}` : '')}${(message ? `${cssPadding}${cssSeparator}${cssPadding}${message}` : '')}`;
message = `${sha}${(authorAndDate ? `\u00a0\u2022\u00a0${authorAndDate}` : '')}${(message ? `\u00a0\u2022\u00a0${message}` : '')}`;
}
else if (config.annotation.author || config.annotation.date) {
message = `${authorAndDate}${(message ? `${cssPadding}${cssSeparator}${cssPadding}${message}` : '')}`;
message = `${authorAndDate}${(message ? `\u00a0\u2022\u00a0${message}` : '')}`;
}
return message;
@ -51,13 +34,13 @@ export class BlameAnnotationFormatter {
const author = this.getAuthor(config, commit, defaultAuthorLength);
const date = this.getDate(config, commit, config.annotation.dateFormat || 'MM/DD/YYYY', true);
if (config.annotation.sha) {
message = `${sha}${(author ? `${cssPadding}${cssSeparator}${cssPadding}${author}` : '')}${(date ? `${cssPadding}${cssSeparator}${cssPadding}${date}` : '')}${(message ? `${cssPadding}${cssSeparator}${cssPadding}${message}` : '')}`;
message = `${sha}${(author ? `\u00a0\u2022\u00a0${author}` : '')}${(date ? `\u00a0\u2022\u00a0${date}` : '')}${(message ? `\u00a0\u2022\u00a0${message}` : '')}`;
}
else if (config.annotation.author) {
message = `${author}${(date ? `${cssPadding}${cssSeparator}${cssPadding}${date}` : '')}${(message ? `${cssPadding}${cssSeparator}${cssPadding}${message}` : '')}`;
message = `${author}${(date ? `\u00a0\u2022\u00a0${date}` : '')}${(message ? `\u00a0\u2022\u00a0${message}` : '')}`;
}
else if (config.annotation.date) {
message = `${date}${(message ? `${cssPadding}${cssSeparator}${cssPadding}${message}` : '')}`;
message = `${date}${(message ? `\u00a0\u2022\u00a0${message}` : '')}`;
}
return message;
@ -93,11 +76,11 @@ export class BlameAnnotationFormatter {
if (!truncateTo) return author;
if (author.length > truncateTo) {
return `${author.substring(0, truncateTo - cssEllipse.length)}${cssEllipse}`;
return `${author.substring(0, truncateTo - 1)}\u2026`;
}
if (force) return author; // Don't pad when just asking for the value
return author + cssPadding.repeat(truncateTo - author.length);
return author + '\u00a0'.repeat(truncateTo - author.length);
}
static getDate(config: IBlameConfig, commit: GitCommit, format: string, truncate: boolean = false, force: boolean = false) {
@ -110,11 +93,11 @@ export class BlameAnnotationFormatter {
const truncateTo = config.annotation.date === 'relative' ? defaultRelativeDateLength : defaultAbsoluteDateLength;
if (date.length > truncateTo) {
return `${date.substring(0, truncateTo - cssEllipse.length)}${cssEllipse}`;
return `${date.substring(0, truncateTo - 1)}\u2026`;
}
if (force) return date; // Don't pad when just asking for the value
return date + cssPadding.repeat(truncateTo - date.length);
return date + '\u00a0'.repeat(truncateTo - date.length);
}
static getMessage(config: IBlameConfig, commit: GitCommit, truncateTo: number = 0, force: boolean = false) {
@ -122,7 +105,7 @@ export class BlameAnnotationFormatter {
let message = commit.isUncommitted ? 'Uncommitted change' : commit.message;
if (truncateTo && message.length > truncateTo) {
return `${message.substring(0, truncateTo - cssEllipse.length)}${cssEllipse}`;
return `${message.substring(0, truncateTo - 1)}\u2026`;
}
return message;

+ 4
- 4
src/blameAnnotationProvider.ts 查看文件

@ -1,7 +1,7 @@
'use strict';
import { Iterables } from './system';
import { DecorationInstanceRenderOptions, DecorationOptions, Disposable, ExtensionContext, Range, TextDocument, TextEditor, TextEditorSelectionChangeEvent, window, workspace } from 'vscode';
import { BlameAnnotationFormat, BlameAnnotationFormatter, cssIndent, defaultAuthorLength } from './blameAnnotationFormatter';
import { BlameAnnotationFormat, BlameAnnotationFormatter, defaultAuthorLength } from './blameAnnotationFormatter';
import { BlameDecorations } from './blameAnnotationController';
import { TextDocumentComparer } from './comparers';
import { BlameAnnotationStyle, IBlameConfig } from './configuration';
@ -170,13 +170,13 @@ export class BlameAnnotationProvider extends Disposable {
gutter = commit.shortSha;
break;
case 1:
gutter = `${cssIndent} ${BlameAnnotationFormatter.getAuthor(this._config, commit, defaultAuthorLength, true)}`;
gutter = `\u2759 ${BlameAnnotationFormatter.getAuthor(this._config, commit, defaultAuthorLength, true)}`;
break;
case 2:
gutter = `${cssIndent} ${BlameAnnotationFormatter.getDate(this._config, commit, this._config.annotation.dateFormat || 'MM/DD/YYYY', true, true)}`;
gutter = `\u2759 ${BlameAnnotationFormatter.getDate(this._config, commit, this._config.annotation.dateFormat || 'MM/DD/YYYY', true, true)}`;
break;
default:
gutter = `${cssIndent}`;
gutter = `\u2759`;
break;
}
}

+ 0
- 6
src/configuration.ts 查看文件

@ -19,12 +19,6 @@ export interface IBlameConfig {
dateFormat: string;
message: boolean;
activeLine: 'off' | 'inline' | 'hover' | 'both';
characters: {
ellipse: string;
indent: string;
padding: string;
separator: string;
}
};
}

+ 0
- 3
src/extension.ts 查看文件

@ -3,7 +3,6 @@ import { Objects } from './system';
import { commands, ExtensionContext, extensions, languages, Uri, window, workspace } from 'vscode';
import { BlameActiveLineController } from './blameActiveLineController';
import { BlameAnnotationController } from './blameAnnotationController';
import { configureCssCharacters } from './blameAnnotationFormatter';
import { CommandContext, setCommandContext } from './commands';
import { CloseUnchangedFilesCommand, OpenChangedFilesCommand } from './commands';
import { OpenCommitInRemoteCommand, OpenFileInRemoteCommand, OpenInRemoteCommand } from './commands';
@ -40,8 +39,6 @@ export async function activate(context: ExtensionContext) {
const config = workspace.getConfiguration('').get<IConfig>('gitlens');
const gitPath = config.advanced.git;
configureCssCharacters(config.blame);
try {
await Git.getGitPath(gitPath);
}

正在加载...
取消
保存