diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b63728..1b7cc22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## [Unreleased] ### Fixed - Fixes [#247](https://github.com/eamodio/vscode-gitlens/issues/247) - File annotations button or ESC key does not turn off file annotations +- Fixes issue where sometimes blame context wasn't available for the open editor when starting vscode ## [7.5.4] - 2018-01-17 ### Fixed diff --git a/src/container.ts b/src/container.ts index bd573b9..aecfa71 100644 --- a/src/container.ts +++ b/src/container.ts @@ -19,6 +19,10 @@ export class Container { context.subscriptions.push(Container._tracker = new DocumentTracker()); context.subscriptions.push(Container._git = new GitService()); + + // Since there is a chicken/egg problem with the DocumentTracker and the GitService, initialize the tracker once the GitService is loaded + Container._tracker.initialize(); + context.subscriptions.push(Container._annotationController = new AnnotationController()); context.subscriptions.push(Container._currentLineController = new CurrentLineController()); context.subscriptions.push(Container._codeLensController = new CodeLensController()); diff --git a/src/trackers/documentTracker.ts b/src/trackers/documentTracker.ts index ae7bf62..8f2d306 100644 --- a/src/trackers/documentTracker.ts +++ b/src/trackers/documentTracker.ts @@ -63,6 +63,10 @@ export class DocumentTracker extends Disposable { this.clear(); } + initialize() { + this.onActiveTextEditorChanged(window.activeTextEditor); + } + private onConfigurationChanged(e: ConfigurationChangeEvent) { const initializing = configuration.initializing(e);