Переглянути джерело

Fixes #249 - Gitlens disappears from the status bar

main
Eric Amodio 7 роки тому
джерело
коміт
3409b3280f
2 змінених файлів з 15 додано та 10 видалено
  1. +1
    -0
      CHANGELOG.md
  2. +14
    -10
      src/currentLineController.ts

+ 1
- 0
CHANGELOG.md Переглянути файл

@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
## [Unreleased]
### Fixed
- Fixes [#249](https://github.com/eamodio/vscode-gitlens/issues/249) - Gitlens disappears from the status bar
- Fixes issue where [Gravatars](https://en.gravatar.com/) in the gutter blame annotations weren't restored on tab switch
- Fixes issue where the id (sha) was missing in the hover blame annotations for uncommitted changes

+ 14
- 10
src/currentLineController.ts Переглянути файл

@ -142,8 +142,7 @@ export class CurrentLineController extends Disposable {
if (!changed) return;
const trackCurrentLine = cfg.statusBar.enabled ||
cfg.blame.line.enabled ||
const trackCurrentLine = cfg.statusBar.enabled || cfg.blame.line.enabled ||
(this._blameAnnotationState !== undefined && this._blameAnnotationState.enabled);
if (trackCurrentLine) {
@ -318,7 +317,7 @@ export class CurrentLineController extends Disposable {
}
}
this.updateStatusBar(commit);
this.updateStatusBar(commit, editor);
this.updateTrailingAnnotation(commit, blameLine, editor, line);
}
@ -384,7 +383,12 @@ export class CurrentLineController extends Disposable {
}
private getBlameAnnotationState() {
return this._blameAnnotationState !== undefined ? this._blameAnnotationState : Container.config.blame.line;
if (this._blameAnnotationState !== undefined) return this._blameAnnotationState;
return {
enabled: Container.config.blame.line.enabled || Container.config.statusBar.enabled,
annotationType: Container.config.blame.line.annotationType
};
}
private _updateBlameDebounced: ((line: number, editor: TextEditor, trackedDocument: TrackedDocument<GitDocumentState>) => void) & IDeferrable;
@ -489,9 +493,9 @@ export class CurrentLineController extends Disposable {
this.clear(editor);
}
private updateStatusBar(commit: GitCommit) {
private updateStatusBar(commit: GitCommit, editor: TextEditor) {
const cfg = Container.config.statusBar;
if (!cfg.enabled || this._statusBarItem === undefined) return;
if (!cfg.enabled || this._statusBarItem === undefined || !isTextEditor(editor)) return;
this._statusBarItem.text = `$(git-commit) ${CommitFormatter.fromTemplate(cfg.format, commit, {
truncateMessageAtNewLine: true,
@ -531,13 +535,13 @@ export class CurrentLineController extends Disposable {
}
private async updateTrailingAnnotation(commit: GitCommit, blameLine: GitCommitLine, editor: TextEditor, line?: number) {
const state = this.getBlameAnnotationState();
if (!state.enabled || state.annotationType !== LineAnnotationType.Trailing || !isTextEditor(editor)) return;
const cfg = Container.config.blame.line;
if (!cfg.enabled || cfg.annotationType !== LineAnnotationType.Trailing || !isTextEditor(editor)) return;
line = line === undefined ? blameLine.line : line;
const cfg = Container.config.annotations.line.trailing;
const decoration = Annotations.trailing(commit, cfg.format, cfg.dateFormat === null ? Container.config.defaultDateFormat : cfg.dateFormat);
const cfgTrailing = Container.config.annotations.line.trailing;
const decoration = Annotations.trailing(commit, cfgTrailing.format, cfgTrailing.dateFormat === null ? Container.config.defaultDateFormat : cfgTrailing.dateFormat);
decoration.range = editor.document.validateRange(new Range(line, RangeEndOfLineIndex, line, RangeEndOfLineIndex));
editor.setDecorations(annotationDecoration, [decoration]);

Завантаження…
Відмінити
Зберегти