@@ -23,7 +23,11 @@ export class GitHistoryCodeLens extends CodeLens {
23
23
export default class GitCodeLensProvider implements CodeLensProvider {
24
24
static selector : DocumentSelector = { scheme : DocumentSchemes . File } ;
25
25
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
+ }
27
31
28
32
provideCodeLenses ( document : TextDocument , token : CancellationToken ) : CodeLens [ ] | Thenable < CodeLens [ ] > {
29
33
const fileName = document . fileName ;
@@ -38,7 +42,9 @@ export default class GitCodeLensProvider implements CodeLensProvider {
38
42
if ( ! lenses . find ( l => l . range . start . line === 0 && l . range . end . line === 0 ) ) {
39
43
const blameRange = document . validateRange ( new Range ( 0 , 1000000 , 1000000 , 1000000 ) ) ;
40
44
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
+ }
42
48
}
43
49
return lenses ;
44
50
} ) ;
@@ -71,7 +77,9 @@ export default class GitCodeLensProvider implements CodeLensProvider {
71
77
}
72
78
73
79
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
+ }
75
83
}
76
84
77
85
resolveCodeLens ( lens : CodeLens , token : CancellationToken ) : Thenable < CodeLens > {
0 commit comments