mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-14 10:03:15 -05:00
Fixes updating CodeLens after file save
Fixes updating active line annotations after file save
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { Functions, Iterables, Strings } from './system';
|
||||
import { CancellationToken, CodeLens, CodeLensProvider, commands, DocumentSelector, ExtensionContext, Position, Range, SymbolInformation, SymbolKind, TextDocument, Uri, workspace } from 'vscode';
|
||||
import { CancellationToken, CodeLens, CodeLensProvider, commands, DocumentSelector, Event, EventEmitter, ExtensionContext, Position, Range, SymbolInformation, SymbolKind, TextDocument, Uri, workspace } from 'vscode';
|
||||
import { BuiltInCommands, Commands, DocumentSchemes } from './constants';
|
||||
import { CodeLensCommand, CodeLensLocation, IConfig, ICodeLensLanguageLocation } from './configuration';
|
||||
import GitProvider, { GitCommit, GitUri, IGitBlame, IGitBlameLines } from './gitProvider';
|
||||
@@ -31,6 +31,11 @@ export class GitAuthorsCodeLens extends CodeLens {
|
||||
|
||||
export default class GitCodeLensProvider implements CodeLensProvider {
|
||||
|
||||
private _onDidChangeCodeLensesEmitter = new EventEmitter<void>();
|
||||
public get onDidChangeCodeLenses(): Event<void> {
|
||||
return this._onDidChangeCodeLensesEmitter.event;
|
||||
}
|
||||
|
||||
static selector: DocumentSelector = { scheme: DocumentSchemes.File };
|
||||
|
||||
private _config: IConfig;
|
||||
@@ -39,6 +44,11 @@ export default class GitCodeLensProvider implements CodeLensProvider {
|
||||
this._config = workspace.getConfiguration('').get<IConfig>('gitlens');
|
||||
}
|
||||
|
||||
reset() {
|
||||
Logger.log('Triggering a reset of the git CodeLens provider');
|
||||
this._onDidChangeCodeLensesEmitter.fire();
|
||||
}
|
||||
|
||||
async provideCodeLenses(document: TextDocument, token: CancellationToken): Promise<CodeLens[]> {
|
||||
let languageLocations = this._config.codeLens.languageLocations.find(_ => _.language.toLowerCase() === document.languageId);
|
||||
if (languageLocations == null) {
|
||||
|
||||
Reference in New Issue
Block a user