Browse Source

Fixes blame context after save

main
Eric Amodio 7 years ago
parent
commit
8552c1ff75
4 changed files with 13 additions and 5 deletions
  1. +3
    -0
      CHANGELOG.md
  2. +3
    -3
      src/git/gitContextTracker.ts
  3. +6
    -1
      src/git/gitUri.ts
  4. +1
    -1
      src/gitService.ts

+ 3
- 0
CHANGELOG.md View File

@ -8,6 +8,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Changed
- Swaps out Moment.js for date-fns to improve blame annotation performance and to reduce the GitLen bundle size (saves ~400kb)
### Fixed
- Fixes issue where the `Toggle File Blame Annotations` command (`gitlens.toggleFileBlame`) wasn't available after a file was saved
## [5.6.2] - 2017-10-11
### Fixed
- Fixes issue where `Open File` command failed for in many instances (for GitUri resources)

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

@ -81,12 +81,12 @@ export class GitContextTracker extends Disposable {
// this._unsubscribeToDocumentChanges();
// this.updateBlameability(false);
// 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
// https://github.com/Microsoft/vscode/issues/27231
setTimeout(async () => {
let blameable = !e.document.isDirty;
if (blameable) {
blameable = await this.git.getBlameability(new GitUri(e.document.uri));
blameable = await this.git.getBlameability(await GitUri.fromUri(e.document.uri, this.git));
}
this._updateBlameability(blameable);
}, 1);
@ -100,7 +100,7 @@ export class GitContextTracker extends Disposable {
let blameable = !e.isDirty;
if (blameable) {
blameable = await this.git.getBlameability(new GitUri(e.uri));
blameable = await this.git.getBlameability(await GitUri.fromUri(e.uri, this.git));
}
this._updateBlameability(blameable);
}

+ 6
- 1
src/git/gitUri.ts View File

@ -21,6 +21,7 @@ export class GitUri extends ((Uri as any) as UriEx) {
constructor(uri?: Uri, commitOrRepoPath?: IGitCommitInfo | string) {
if (uri === undefined) {
super();
return;
}
@ -36,7 +37,11 @@ export class GitUri extends ((Uri as any) as UriEx) {
return;
}
if (!commitOrRepoPath) return;
if (commitOrRepoPath === undefined) {
super(uri.scheme, uri.authority, uri.path, uri.query, uri.fragment);
return;
}
if (typeof commitOrRepoPath === 'string') {
super(uri.scheme, uri.authority, uri.path, uri.query, uri.fragment);

+ 1
- 1
src/gitService.ts View File

@ -217,8 +217,8 @@ export class GitService extends Disposable {
if (!this.UseCaching) return;
if (e.document.uri.scheme !== DocumentSchemes.File) return;
// 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
// https://github.com/Microsoft/vscode/issues/27231
setTimeout(() => {
// If the document is dirty all is fine, we'll just wait for the save before clearing our cache
if (e.document.isDirty) return;

Loading…
Cancel
Save