From 474fad812c4efb0175997061f2f610ad030d6faa Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 3 Aug 2022 01:15:32 -0400 Subject: [PATCH] Ensures we don't show CodeLens if disabled --- src/codelens/codeLensProvider.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/codelens/codeLensProvider.ts b/src/codelens/codeLensProvider.ts index 6fb04db..f92f198 100644 --- a/src/codelens/codeLensProvider.ts +++ b/src/codelens/codeLensProvider.ts @@ -110,6 +110,9 @@ export class GitCodeLensProvider implements CodeLensProvider { // Since we can't currently blame edited virtual documents, don't even attempt anything if dirty if (document.isDirty && isVirtualUri(document.uri)) return []; + const cfg = configuration.get('codeLens', document); + if (!cfg.enabled) return []; + const trackedDocument = await this.container.tracker.getOrAdd(document); if (!trackedDocument.isBlameable) return []; @@ -126,8 +129,6 @@ export class GitCodeLensProvider implements CodeLensProvider { } } - const cfg = configuration.get('codeLens', document); - let languageScope = cfg.scopesByLanguage?.find(ll => ll.language?.toLowerCase() === document.languageId); if (languageScope == null) { languageScope = {