File tree Expand file tree Collapse file tree 2 files changed +20
-8
lines changed
vscode-js-profile-core/src Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 4
4
5
5
import {
6
6
CodeLens ,
7
+ CodeLensProvider ,
8
+ commands ,
7
9
Disposable ,
8
10
EventEmitter ,
9
- CodeLensProvider ,
10
- TextDocument ,
11
11
ProviderResult ,
12
+ TextDocument ,
12
13
} from 'vscode' ;
13
- import { lowerCaseInsensitivePath } from './path' ;
14
14
import { DownloadFileProvider } from './download-file-provider' ;
15
+ import { lowerCaseInsensitivePath } from './path' ;
15
16
import { ProfileAnnotations } from './profileAnnotations' ;
16
17
17
18
/**
@@ -31,13 +32,13 @@ export class ProfileCodeLensProvider implements CodeLensProvider {
31
32
*/
32
33
// eslint-disable-next-line @typescript-eslint/no-explicit-any
33
34
public registerLenses ( lenses : ProfileAnnotations ) : Disposable {
35
+ commands . executeCommand ( 'setContext' , 'jsProfileVisualizer.hasCodeLenses' , true ) ;
34
36
this . lenses = lenses ;
35
37
36
38
return {
37
39
dispose : ( ) => {
38
40
if ( this . lenses === lenses ) {
39
- this . lenses = undefined ;
40
- this . changeEmitter . fire ( ) ;
41
+ this . clear ( ) ;
41
42
}
42
43
} ,
43
44
} ;
@@ -47,8 +48,11 @@ export class ProfileCodeLensProvider implements CodeLensProvider {
47
48
* Clears the current set of profiling lenses.
48
49
*/
49
50
public clear ( ) {
50
- this . lenses = undefined ;
51
- this . changeEmitter . fire ( ) ;
51
+ if ( this . lenses ) {
52
+ this . lenses = undefined ;
53
+ commands . executeCommand ( 'setContext' , 'jsProfileVisualizer.hasCodeLenses' , false ) ;
54
+ this . changeEmitter . fire ( ) ;
55
+ }
52
56
}
53
57
54
58
/**
Original file line number Diff line number Diff line change 58
58
"command" : " extension.jsProfileVisualizer.table.clearCodeLenses" ,
59
59
"title" : " Clear Profile Code Lenses"
60
60
}
61
- ]
61
+ ],
62
+ "menus" : {
63
+ "commandPalette" : [
64
+ {
65
+ "command" : " extension.jsProfileVisualizer.table.clearCodeLenses" ,
66
+ "when" : " jsProfileVisualizer.hasCodeLenses == true"
67
+ }
68
+ ]
69
+ }
62
70
},
63
71
"bugs" : {
64
72
"url" : " https://github.com/microsoft/vscode-js-profile-visualizer/issues"
You can’t perform that action at this time.
0 commit comments