Browse Source

Renames statusBar to more generic activeLine

main
Eric Amodio 7 years ago
parent
commit
f66ba92e3c
3 changed files with 302 additions and 302 deletions
  1. +7
    -7
      src/blameActiveLineController.ts
  2. +1
    -1
      src/extension.ts

src/blameStatusBarController.ts → src/blameActiveLineController.ts View File

@ -15,7 +15,7 @@ const activeLineDecoration: TextEditorDecorationType = window.createTextEditorDe
} }
} as DecorationRenderOptions); } as DecorationRenderOptions);
export default class BlameStatusBarController extends Disposable {
export default class BlameActiveLineController extends Disposable {
private _activeEditorLineDisposable: Disposable | undefined; private _activeEditorLineDisposable: Disposable | undefined;
private _blame: Promise<IGitBlame> | undefined; private _blame: Promise<IGitBlame> | undefined;
@ -23,15 +23,15 @@ export default class BlameStatusBarController extends Disposable {
private _currentLine: number = -1; private _currentLine: number = -1;
private _disposable: Disposable; private _disposable: Disposable;
private _editor: TextEditor | undefined; private _editor: TextEditor | undefined;
private _showBlameDebounced: (line: number, editor: TextEditor) => Promise<void>;
private _statusBarItem: StatusBarItem | undefined; private _statusBarItem: StatusBarItem | undefined;
private _updateBlameDebounced: (line: number, editor: TextEditor) => Promise<void>;
private _uri: GitUri; private _uri: GitUri;
private _useCaching: boolean; private _useCaching: boolean;
constructor(context: ExtensionContext, private git: GitProvider, private annotationController: BlameAnnotationController) { constructor(context: ExtensionContext, private git: GitProvider, private annotationController: BlameAnnotationController) {
super(() => this.dispose()); super(() => this.dispose());
this._showBlameDebounced = Functions.debounce(this._showBlame, 50);
this._updateBlameDebounced = Functions.debounce(this._updateBlame, 50);
this._onConfigure(); this._onConfigure();
@ -136,7 +136,7 @@ export default class BlameStatusBarController extends Disposable {
this._blame = undefined; this._blame = undefined;
} }
this._showBlame(e.selection.active.line, e);
this._updateBlame(e.selection.active.line, e);
} }
private _onEditorSelectionChanged(e: TextEditorSelectionChangeEvent): void { private _onEditorSelectionChanged(e: TextEditorSelectionChangeEvent): void {
@ -147,7 +147,7 @@ export default class BlameStatusBarController extends Disposable {
if (line === this._currentLine) return; if (line === this._currentLine) return;
this._currentLine = line; this._currentLine = line;
this._showBlameDebounced(line, e.textEditor);
this._updateBlameDebounced(line, e.textEditor);
} }
private _onDocumentChanged(e: TextDocumentChangeEvent) { private _onDocumentChanged(e: TextDocumentChangeEvent) {
@ -155,10 +155,10 @@ export default class BlameStatusBarController extends Disposable {
if (!this._editor || !TextDocumentComparer.equals(e.document, this._editor.document)) return; if (!this._editor || !TextDocumentComparer.equals(e.document, this._editor.document)) return;
this._currentLine = -1; this._currentLine = -1;
this._showBlame(this._editor.selections[0].active.line, this._editor);
this._updateBlame(this._editor.selections[0].active.line, this._editor);
} }
private async _showBlame(line: number, editor: TextEditor) {
private async _updateBlame(line: number, editor: TextEditor) {
line = line - this._uri.offset; line = line - this._uri.offset;
let commitLine: IGitCommitLine; let commitLine: IGitCommitLine;

+ 1
- 1
src/extension.ts View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
import { ExtensionContext, languages, window, workspace } from 'vscode'; import { ExtensionContext, languages, window, workspace } from 'vscode';
import BlameActiveLineController from './blameActiveLineController';
import BlameAnnotationController from './blameAnnotationController'; import BlameAnnotationController from './blameAnnotationController';
import BlameStatusBarController from './blameStatusBarController';
import { configureCssCharacters } from './blameAnnotationFormatter'; import { configureCssCharacters } from './blameAnnotationFormatter';
import DiffLineWithPreviousCommand from './commands/diffLineWithPrevious'; import DiffLineWithPreviousCommand from './commands/diffLineWithPrevious';
import DiffLineWithWorkingCommand from './commands/diffLineWithWorking'; import DiffLineWithWorkingCommand from './commands/diffLineWithWorking';

Loading…
Cancel
Save