@@ -23,7 +23,11 @@ export class GitHistoryCodeLens extends CodeLens {
2323export default class GitCodeLensProvider implements CodeLensProvider {
2424 static selector : DocumentSelector = { scheme : DocumentSchemes . File } ;
2525
26- constructor ( context : ExtensionContext , private git : GitProvider ) { }
26+ private hasGitHistoryExtension : boolean ;
27+
28+ constructor ( context : ExtensionContext , private git : GitProvider ) {
29+ this . hasGitHistoryExtension = context . workspaceState . get ( WorkspaceState . HasGitHistoryExtension , false ) ;
30+ }
2731
2832 provideCodeLenses ( document : TextDocument , token : CancellationToken ) : CodeLens [ ] | Thenable < CodeLens [ ] > {
2933 const fileName = document . fileName ;
@@ -38,7 +42,9 @@ export default class GitCodeLensProvider implements CodeLensProvider {
3842 if ( ! lenses . find ( l => l . range . start . line === 0 && l . range . end . line === 0 ) ) {
3943 const blameRange = document . validateRange ( new Range ( 0 , 1000000 , 1000000 , 1000000 ) ) ;
4044 lenses . push ( new GitCodeLens ( this . git , fileName , blameRange , new Range ( 0 , 0 , 0 , blameRange . start . character ) ) ) ;
41- lenses . push ( new GitHistoryCodeLens ( this . git . repoPath , fileName , new Range ( 0 , 1 , 0 , blameRange . start . character ) ) ) ;
45+ if ( this . hasGitHistoryExtension ) {
46+ lenses . push ( new GitHistoryCodeLens ( this . git . repoPath , fileName , new Range ( 0 , 1 , 0 , blameRange . start . character ) ) ) ;
47+ }
4248 }
4349 return lenses ;
4450 } ) ;
@@ -71,7 +77,9 @@ export default class GitCodeLensProvider implements CodeLensProvider {
7177 }
7278
7379 lenses . push ( new GitCodeLens ( this . git , fileName , symbol . location . range , line . range . with ( new Position ( line . range . start . line , startChar ) ) ) ) ;
74- lenses . push ( new GitHistoryCodeLens ( this . git . repoPath , fileName , line . range . with ( new Position ( line . range . start . line , startChar + 1 ) ) ) ) ;
80+ if ( this . hasGitHistoryExtension ) {
81+ lenses . push ( new GitHistoryCodeLens ( this . git . repoPath , fileName , line . range . with ( new Position ( line . range . start . line , startChar + 1 ) ) ) ) ;
82+ }
7583 }
7684
7785 resolveCodeLens ( lens : CodeLens , token : CancellationToken ) : Thenable < CodeLens > {
0 commit comments