소스 검색

Closes #382 - re-allows line blame when debugging

main
Eric Amodio 5 년 전
부모
커밋
fa9f119a7e
4개의 변경된 파일21개의 추가작업 그리고 78개의 파일을 삭제
  1. +4
    -0
      CHANGELOG.md
  2. +12
    -49
      src/annotations/lineAnnotationController.ts
  3. +1
    -1
      src/config.ts
  4. +4
    -28
      src/hovers/lineHoverController.ts

+ 4
- 0
CHANGELOG.md 파일 보기

@ -31,6 +31,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Improves the behavior of the _Open Changes with Working File_ (`gitlens.diffWithWorking`) command when in the diff editor
- Updates the invite link to the [VS Code Development Community Slack](https://vscode-slack.amod.io)
### Removed
- Removes the automatic suspension of the current line blame annotations while debugging — closes [#382](https://github.com/eamodio/vscode-gitlens/issues/382)
### Fixed
- Fixes [#683](https://github.com/eamodio/vscode-gitlens/issues/683) - log.showSignature leads to stray files being displayed

+ 12
- 49
src/annotations/lineAnnotationController.ts 파일 보기

@ -1,7 +1,6 @@
'use strict';
import {
ConfigurationChangeEvent,
debug,
DecorationOptions,
DecorationRangeBehavior,
Disposable,
@ -27,15 +26,13 @@ const annotationDecoration: TextEditorDecorationType = window.createTextEditorDe
export class LineAnnotationController implements Disposable {
private _disposable: Disposable;
private _debugSessionEndDisposable: Disposable | undefined;
private _editor: TextEditor | undefined;
private _enabled: boolean = false;
constructor() {
this._disposable = Disposable.from(
configuration.onDidChange(this.onConfigurationChanged, this),
Container.fileAnnotations.onDidToggleAnnotations(this.onFileAnnotationsToggled, this),
debug.onDidStartDebugSession(this.onDebugSessionStarted, this)
Container.fileAnnotations.onDidToggleAnnotations(this.onFileAnnotationsToggled, this)
);
this.onConfigurationChanged(configuration.initializingChangeEvent);
}
@ -43,8 +40,6 @@ export class LineAnnotationController implements Disposable {
dispose() {
this.clearAnnotations(this._editor);
this._debugSessionEndDisposable && this._debugSessionEndDisposable.dispose();
Container.lineTracker.stop(this);
this._disposable && this._disposable.dispose();
}
@ -66,40 +61,29 @@ export class LineAnnotationController implements Disposable {
void this.refresh(window.activeTextEditor);
}
private _suspended?: 'debugging' | 'user';
private _suspended: boolean = false;
get suspended() {
return !this._enabled || this._suspended !== undefined;
return !this._enabled || this._suspended;
}
@log()
resume(reason: 'debugging' | 'user' = 'user') {
resume() {
this.setLineTracker(true);
switch (reason) {
case 'debugging':
if (this._suspended !== 'user') {
this._suspended = undefined;
return true;
}
break;
case 'user':
if (this._suspended !== undefined) {
this._suspended = undefined;
return true;
}
break;
if (this._suspended) {
this._suspended = false;
return true;
}
return false;
}
@log()
suspend(reason: 'debugging' | 'user' = 'user') {
suspend() {
this.setLineTracker(false);
if (this._suspended !== 'user') {
this._suspended = reason;
if (!this._suspended) {
this._suspended = true;
return true;
}
@ -116,27 +100,6 @@ export class LineAnnotationController implements Disposable {
this.clear(e.editor);
}
private onDebugSessionStarted() {
if (this._debugSessionEndDisposable === undefined) {
this._debugSessionEndDisposable = debug.onDidTerminateDebugSession(this.onDebugSessionEnded, this);
}
if (this.suspend('debugging')) {
void this.refresh(window.activeTextEditor);
}
}
private onDebugSessionEnded() {
if (this._debugSessionEndDisposable !== undefined) {
this._debugSessionEndDisposable.dispose();
this._debugSessionEndDisposable = undefined;
}
if (this.resume('debugging')) {
void this.refresh(window.activeTextEditor);
}
}
private onFileAnnotationsToggled() {
void this.refresh(window.activeTextEditor);
}
@ -152,11 +115,11 @@ export class LineAnnotationController implements Disposable {
this._enabled = !(this._enabled && !this.suspended);
if (this._enabled) {
if (this.resume('user')) {
if (this.resume()) {
await this.refresh(editor);
}
}
else if (this.suspend('user')) {
else if (this.suspend()) {
await this.refresh(editor);
}
}

+ 1
- 1
src/config.ts 파일 보기

@ -20,10 +20,10 @@ export interface Config {
toggleMode: AnnotationsToggleMode;
};
currentLine: {
scrollable: boolean;
dateFormat: string | null;
enabled: boolean;
format: string;
scrollable: boolean;
};
codeLens: CodeLensConfig;
debug: boolean;

+ 4
- 28
src/hovers/lineHoverController.ts 파일 보기

@ -2,7 +2,6 @@
import {
CancellationToken,
ConfigurationChangeEvent,
debug,
Disposable,
Hover,
languages,
@ -18,23 +17,17 @@ import { Container } from '../container';
import { LinesChangeEvent } from '../trackers/gitLineTracker';
export class LineHoverController implements Disposable {
private _debugSessionEndDisposable: Disposable | undefined;
private _disposable: Disposable;
private _hoverProviderDisposable: Disposable | undefined;
constructor() {
this._disposable = Disposable.from(
configuration.onDidChange(this.onConfigurationChanged, this),
debug.onDidStartDebugSession(this.onDebugSessionStarted, this)
);
this._disposable = Disposable.from(configuration.onDidChange(this.onConfigurationChanged, this));
this.onConfigurationChanged(configuration.initializingChangeEvent);
}
dispose() {
this.unregister();
this._debugSessionEndDisposable && this._debugSessionEndDisposable.dispose();
Container.lineTracker.stop(this);
this._disposable && this._disposable.dispose();
}
@ -61,10 +54,6 @@ export class LineHoverController implements Disposable {
}
}
private get debugging() {
return this._debugSessionEndDisposable !== undefined;
}
private onActiveLinesChanged(e: LinesChangeEvent) {
if (e.pending || e.reason !== 'editor') return;
@ -77,19 +66,6 @@ export class LineHoverController implements Disposable {
this.register(e.editor);
}
private onDebugSessionStarted() {
if (this._debugSessionEndDisposable === undefined) {
this._debugSessionEndDisposable = debug.onDidTerminateDebugSession(this.onDebugSessionEnded, this);
}
}
private onDebugSessionEnded() {
if (this._debugSessionEndDisposable !== undefined) {
this._debugSessionEndDisposable.dispose();
this._debugSessionEndDisposable = undefined;
}
}
async provideDetailsHover(
document: TextDocument,
position: Position,
@ -105,7 +81,7 @@ export class LineHoverController implements Disposable {
const fileAnnotations = await Container.fileAnnotations.getAnnotationType(window.activeTextEditor);
if (fileAnnotations !== undefined && Container.config.hovers.annotations.details) return undefined;
const wholeLine = this.debugging ? false : Container.config.hovers.currentLine.over === 'line';
const wholeLine = Container.config.hovers.currentLine.over === 'line';
// If we aren't showing the hover over the whole line, make sure the annotation is on
if (!wholeLine && Container.lineAnnotations.suspended) return undefined;
@ -161,7 +137,7 @@ export class LineHoverController implements Disposable {
if (fileAnnotations !== undefined) return undefined;
}
const wholeLine = this.debugging ? false : Container.config.hovers.currentLine.over === 'line';
const wholeLine = Container.config.hovers.currentLine.over === 'line';
// If we aren't showing the hover over the whole line, make sure the annotation is on
if (!wholeLine && Container.lineAnnotations.suspended) return undefined;
@ -182,7 +158,7 @@ export class LineHoverController implements Disposable {
private register(editor: TextEditor | undefined) {
this.unregister();
if (editor === undefined /* || this.suspended */) return;
if (editor === undefined) return;
const cfg = Container.config.hovers;
if (!cfg.enabled || !cfg.currentLine.enabled || (!cfg.currentLine.details && !cfg.currentLine.changes)) return;

불러오는 중...
취소
저장