@@ -47,53 +47,69 @@ export function activate(context: vscode.ExtensionContext) {
47
47
} ) ;
48
48
context . subscriptions . push ( componentHierarchyMarkdownDisposable ) ;
49
49
50
+ let componentHierarchyPanel : vscode . WebviewPanel | undefined = undefined ;
50
51
const showComponentHierarchyDisposable = vscode . commands . registerCommand ( `${ cmdPrefix } .${ ShowComponentHierarchy . commandName } ` , ( ) => {
51
- const componentHierarchyPanel = vscode . window . createWebviewPanel (
52
- 'angularTools_showComponentHierarchy' ,
53
- 'Angular component hierarchy' ,
54
- vscode . ViewColumn . One ,
55
- {
56
- enableScripts : true
57
- }
58
- ) ;
59
- componentHierarchyPanel . onDidDispose ( ( ) => {
60
- } , null , context . subscriptions ) ;
52
+ if ( componentHierarchyPanel !== undefined ) {
53
+ componentHierarchyPanel . reveal ( vscode . ViewColumn . One ) ;
54
+ } else {
55
+ componentHierarchyPanel = vscode . window . createWebviewPanel (
56
+ 'angularTools_showComponentHierarchy' ,
57
+ 'Angular component hierarchy' ,
58
+ vscode . ViewColumn . One ,
59
+ {
60
+ enableScripts : true
61
+ }
62
+ ) ;
63
+ componentHierarchyPanel . onDidDispose ( ( ) => {
64
+ } , null , context . subscriptions ) ;
65
+ }
61
66
const command = new ShowComponentHierarchy ( context ) ;
62
67
command . execute ( componentHierarchyPanel . webview ) ;
63
68
} ) ;
64
69
context . subscriptions . push ( showComponentHierarchyDisposable ) ;
65
-
70
+
71
+ let moduleHierarchyPanel : vscode . WebviewPanel | undefined = undefined ;
66
72
const showModuleHierarchyDisposable = vscode . commands . registerCommand ( `${ cmdPrefix } .${ ShowModuleHierarchy . commandName } ` , ( ) => {
67
- const moduleHierarchyPanel = vscode . window . createWebviewPanel (
68
- 'angularTools_showModuleHierarchy' ,
69
- 'Angular module hierarchy' ,
70
- vscode . ViewColumn . One ,
71
- {
72
- enableScripts : true
73
- }
74
- ) ;
75
- moduleHierarchyPanel . onDidDispose ( ( ) => {
76
- } , null , context . subscriptions ) ;
73
+ if ( moduleHierarchyPanel !== undefined ) {
74
+ moduleHierarchyPanel . reveal ( vscode . ViewColumn . One ) ;
75
+ } else {
76
+ moduleHierarchyPanel = vscode . window . createWebviewPanel (
77
+ 'angularTools_showModuleHierarchy' ,
78
+ 'Angular module hierarchy' ,
79
+ vscode . ViewColumn . One ,
80
+ {
81
+ enableScripts : true
82
+ }
83
+ ) ;
84
+ moduleHierarchyPanel . onDidDispose ( ( ) => {
85
+ } , null , context . subscriptions ) ;
86
+ }
77
87
const command = new ShowModuleHierarchy ( context ) ;
78
88
command . execute ( moduleHierarchyPanel . webview ) ;
79
89
} ) ;
80
90
context . subscriptions . push ( showModuleHierarchyDisposable ) ;
81
-
91
+
92
+ let dependencyInjectionGraphPanel : vscode . WebviewPanel | undefined = undefined ;
82
93
const generateDependencyInjectionGraphDisposable = vscode . commands . registerCommand ( `${ cmdPrefix } .${ GenerateDependencyInjectionGraph . commandName } ` , ( ) => {
83
- const dependencyInjectionGraphPanel = vscode . window . createWebviewPanel (
84
- 'angularTools_generateDependencyInjectionGraph' ,
85
- 'Angular dependency injection graph' ,
86
- vscode . ViewColumn . One ,
87
- {
88
- enableScripts : true
89
- }
90
- ) ;
91
- dependencyInjectionGraphPanel . onDidDispose ( ( ) => {
92
- } , null , context . subscriptions ) ;
94
+ if ( dependencyInjectionGraphPanel !== undefined ) {
95
+ dependencyInjectionGraphPanel . reveal ( vscode . ViewColumn . One ) ;
96
+ } else {
97
+ dependencyInjectionGraphPanel = vscode . window . createWebviewPanel (
98
+ 'angularTools_generateDependencyInjectionGraph' ,
99
+ 'Angular dependency injection graph' ,
100
+ vscode . ViewColumn . One ,
101
+ {
102
+ enableScripts : true
103
+ }
104
+ ) ;
105
+ dependencyInjectionGraphPanel . onDidDispose ( ( ) => {
106
+ } , null , context . subscriptions ) ;
107
+ }
93
108
const command = new GenerateDependencyInjectionGraph ( context ) ;
94
109
command . execute ( dependencyInjectionGraphPanel . webview ) ;
95
110
} ) ;
96
- context . subscriptions . push ( generateDependencyInjectionGraphDisposable ) ; }
111
+ context . subscriptions . push ( generateDependencyInjectionGraphDisposable ) ;
112
+ }
97
113
98
114
// this method is called when your extension is deactivated
99
115
export function deactivate ( ) { }
0 commit comments