@@ -90,18 +90,14 @@ export class GitCodeLensProvider implements CodeLensProvider {
9090 let languageScope = cfg . scopesByLanguage && cfg . scopesByLanguage . find ( ll => ll . language !== undefined && ll . language . toLowerCase ( ) === document . languageId ) ;
9191 if ( languageScope == null ) {
9292 languageScope = {
93- language : undefined ,
94- scopes : cfg . scopes ,
95- symbolScopes : cfg . symbolScopes
93+ language : undefined
9694 } as CodeLensLanguageScope ;
9795 }
98- else {
99- if ( languageScope . scopes === undefined ) {
100- languageScope . scopes = cfg . scopes ;
101- }
102- if ( languageScope . symbolScopes === undefined ) {
103- languageScope . symbolScopes = cfg . symbolScopes ;
104- }
96+ if ( languageScope . scopes == null ) {
97+ languageScope . scopes = cfg . scopes ;
98+ }
99+ if ( languageScope . symbolScopes == null ) {
100+ languageScope . symbolScopes = cfg . symbolScopes ;
105101 }
106102
107103 languageScope . symbolScopes = languageScope . symbolScopes != null
@@ -148,7 +144,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
148144
149145 if ( symbols !== undefined ) {
150146 Logger . log ( 'GitCodeLensProvider.provideCodeLenses:' , `${ symbols . length } symbol(s) found` ) ;
151- symbols . forEach ( sym => this . provideCodeLens ( lenses , document , sym , languageScope ! , documentRangeFn , blame , gitUri , cfg , dirty , dirtyCommand ) ) ;
147+ symbols . forEach ( sym => this . provideCodeLens ( lenses , document , sym , languageScope as Required < CodeLensLanguageScope > , documentRangeFn , blame , gitUri , cfg , dirty , dirtyCommand ) ) ;
152148 }
153149
154150 if ( ( languageScope . scopes . includes ( CodeLensScopes . Document ) || languageScope . symbolScopes . includes ( 'file' ) ) && ! languageScope . symbolScopes . includes ( '!file' ) ) {
@@ -196,7 +192,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
196192 return lenses ;
197193 }
198194
199- private validateSymbolAndGetBlameRange ( symbol : SymbolInformation , languageScope : CodeLensLanguageScope , documentRangeFn : ( ) => Range ) : Range | undefined {
195+ private validateSymbolAndGetBlameRange ( symbol : SymbolInformation , languageScope : Required < CodeLensLanguageScope > , documentRangeFn : ( ) => Range ) : Range | undefined {
200196 let valid = false ;
201197 let range : Range | undefined ;
202198
@@ -255,7 +251,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
255251 return valid ? range || symbol . location . range : undefined ;
256252 }
257253
258- private provideCodeLens ( lenses : CodeLens [ ] , document : TextDocument , symbol : SymbolInformation , languageScope : CodeLensLanguageScope , documentRangeFn : ( ) => Range , blame : GitBlame | undefined , gitUri : GitUri | undefined , cfg : ICodeLensConfig , dirty : boolean , dirtyCommand : Command | undefined ) : void {
254+ private provideCodeLens ( lenses : CodeLens [ ] , document : TextDocument , symbol : SymbolInformation , languageScope : Required < CodeLensLanguageScope > , documentRangeFn : ( ) => Range , blame : GitBlame | undefined , gitUri : GitUri | undefined , cfg : ICodeLensConfig , dirty : boolean , dirtyCommand : Command | undefined ) : void {
259255 const blameRange = this . validateSymbolAndGetBlameRange ( symbol , languageScope , documentRangeFn ) ;
260256 if ( blameRange === undefined ) return ;
261257
0 commit comments