Browse Source

Fixes incorrectly setting isBlameable context

main
Eric Amodio 7 years ago
parent
commit
c2a352fc66
3 changed files with 22 additions and 5 deletions
  1. +3
    -0
      CHANGELOG.md
  2. +5
    -2
      src/annotations/annotationController.ts
  3. +14
    -3
      src/git/gitContextTracker.ts

+ 3
- 0
CHANGELOG.md View File

@ -12,6 +12,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Removes `Custom` from the `gitlens.codeLens.locations` setting as it wasn't really required
- Removes properties (symbol `Property`) from being included in the `Blocks` option of the `gitlens.codeLens.locations` setting -- can be easily re-added by setting `"gitlens.codeLens.customLocationSymbols": [ "Property" ]` if desired
### Fixed
- Fixes issue where `isBlameable` context could be set incorrectly leading to blame icon showing up on invalid documents
## [5.5.0] - 2017-10-09
### Added
- Adds a **quick-access** command bar to the bottom of the `details` hover annotations

+ 5
- 2
src/annotations/annotationController.ts View File

@ -325,12 +325,15 @@ export class AnnotationController extends Disposable {
}
return window.withProgress({ location: ProgressLocation.Window }, async (progress: Progress<{ message: string }>) => {
await setCommandContext(CommandContext.AnnotationStatus, AnnotationStatus.Computing);
const active = editor === window.activeTextEditor;
await setCommandContext(CommandContext.AnnotationStatus, active ? AnnotationStatus.Computing : undefined);
const computingAnnotations = this.showAnnotationsCore(currentProvider, editor, type, shaOrLine, progress);
const result = await computingAnnotations;
await setCommandContext(CommandContext.AnnotationStatus, result ? AnnotationStatus.Computed : undefined);
if (active) {
await setCommandContext(CommandContext.AnnotationStatus, result ? AnnotationStatus.Computed : undefined);
}
return computingAnnotations;
});

+ 14
- 3
src/git/gitContextTracker.ts View File

@ -83,15 +83,26 @@ export class GitContextTracker extends Disposable {
// TODO: Rework this once https://github.com/Microsoft/vscode/issues/27231 is released in v1.13
// We have to defer because isDirty is not reliable inside this event
setTimeout(() => this._updateBlameability(!e.document.isDirty), 1);
setTimeout(async () => {
let blameable = !e.document.isDirty;
if (blameable) {
blameable = await this.git.getBlameability(new GitUri(e.document.uri));
}
this._updateBlameability(blameable);
}, 1);
}
private _onTextDocumentSaved(e: TextDocument) {
private async _onTextDocumentSaved(e: TextDocument) {
if (!TextDocumentComparer.equals(this._editor && this._editor.document, e)) return;
// Don't need to resubscribe as we aren't unsubscribing on document changes anymore
// this._subscribeToDocumentChanges();
this._updateBlameability(!e.isDirty);
let blameable = !e.isDirty;
if (blameable) {
blameable = await this.git.getBlameability(new GitUri(e.uri));
}
this._updateBlameability(blameable);
}
private _subscribeToDocumentChanges() {

||||||
x
 
000:0
Loading…
Cancel
Save