From d4bf43bc3e577de82beb996ccb05d08bfdc2a333 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 11 Nov 2020 02:56:49 -0500 Subject: [PATCH] Adds "container" support to markdown files --- src/codelens/codeLensProvider.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/codelens/codeLensProvider.ts b/src/codelens/codeLensProvider.ts index 66648f4..169e10d 100644 --- a/src/codelens/codeLensProvider.ts +++ b/src/codelens/codeLensProvider.ts @@ -95,7 +95,7 @@ export class GitCodeLensProvider implements CodeLensProvider { ]; constructor( - context: ExtensionContext, + _context: ExtensionContext, private readonly _git: GitService, private readonly _tracker: DocumentTracker, ) {} @@ -342,6 +342,19 @@ export class GitCodeLensProvider implements CodeLensProvider { } break; + case SymbolKind.String: + if ( + languageScope.symbolScopes.includes(symbolName) || + // A special case for markdown files, SymbolKind.String seems to be returned for headers, so consider those containers + (languageScope.language === 'markdown' && languageScope.scopes.includes(CodeLensScopes.Containers)) + ) { + range = getRangeFromSymbol(symbol); + valid = + !languageScope.symbolScopes.includes(`!${symbolName}`) && + (includeSingleLineSymbols || !range.isSingleLine); + } + break; + default: if (languageScope.symbolScopes.includes(symbolName)) { range = getRangeFromSymbol(symbol);