11import * as vscode from 'vscode' ;
22import { D_MODE } from "./dmode"
33import { WorkspaceD } from "./workspace-d"
4+ import { CompileButtons } from "./compile-buttons"
45import * as statusbar from "./statusbar"
56
67let diagnosticCollection : vscode . DiagnosticCollection ;
@@ -14,6 +15,7 @@ export function activate(context: vscode.ExtensionContext) {
1415 console . warn ( "Could not initialize code-d" ) ;
1516 return ;
1617 }
18+
1719 let workspaced = new WorkspaceD ( vscode . workspace . rootPath ) ;
1820 context . subscriptions . push ( vscode . languages . registerSignatureHelpProvider ( D_MODE , workspaced , "(" , "," ) ) ;
1921 context . subscriptions . push ( vscode . languages . registerCompletionItemProvider ( D_MODE , workspaced ) ) ;
@@ -22,7 +24,9 @@ export function activate(context: vscode.ExtensionContext) {
2224 context . subscriptions . push ( vscode . languages . registerDefinitionProvider ( D_MODE , workspaced ) ) ;
2325 context . subscriptions . push ( vscode . languages . registerDocumentFormattingEditProvider ( D_MODE , workspaced ) ) ;
2426 context . subscriptions . push ( workspaced ) ;
27+
2528 context . subscriptions . push ( statusbar . setup ( workspaced ) ) ;
29+ context . subscriptions . push ( new CompileButtons ( workspaced ) ) ;
2630
2731 vscode . languages . setLanguageConfiguration ( D_MODE . language , {
2832 __electricCharacterSupport : {
@@ -86,27 +90,27 @@ export function activate(context: vscode.ExtensionContext) {
8690 }
8791 } ) ) ;
8892
89- vscode . commands . registerCommand ( "code-d.switchConfiguration" , ( ) => {
93+ context . subscriptions . push ( vscode . commands . registerCommand ( "code-d.switchConfiguration" , ( ) => {
9094 vscode . window . showQuickPick ( workspaced . listConfigurations ( ) ) . then ( ( config ) => {
9195 if ( config )
9296 workspaced . setConfiguration ( config ) ;
9397 } ) ;
9498 } , ( err ) => {
9599 console . error ( err ) ;
96100 vscode . window . showErrorMessage ( "Failed to switch configuration. See console for details." ) ;
97- } ) ;
101+ } ) ) ;
98102
99- vscode . commands . registerCommand ( "code-d.switchBuildType" , ( ) => {
103+ context . subscriptions . push ( vscode . commands . registerCommand ( "code-d.switchBuildType" , ( ) => {
100104 vscode . window . showQuickPick ( workspaced . listBuildTypes ( ) ) . then ( ( config ) => {
101105 if ( config )
102106 workspaced . setBuildType ( config ) ;
103107 } ) ;
104108 } , ( err ) => {
105109 console . error ( err ) ;
106110 vscode . window . showErrorMessage ( "Failed to switch build type. See console for details." ) ;
107- } ) ;
111+ } ) ) ;
108112
109- vscode . commands . registerCommand ( "code-d.killServer" , ( ) => {
113+ context . subscriptions . push ( vscode . commands . registerCommand ( "code-d.killServer" , ( ) => {
110114 workspaced . killServer ( ) . then ( ( res ) => {
111115 vscode . window . showInformationMessage ( "Killed DCD-Server" , "Restart" ) . then ( ( pick ) => {
112116 if ( pick == "Restart" )
@@ -116,18 +120,18 @@ export function activate(context: vscode.ExtensionContext) {
116120 console . error ( err ) ;
117121 vscode . window . showErrorMessage ( "Failed to kill DCD-Server. See console for details." ) ;
118122 } ) ;
119- } ) ;
123+ } ) ) ;
120124
121- vscode . commands . registerCommand ( "code-d.restartServer" , ( ) => {
125+ context . subscriptions . push ( vscode . commands . registerCommand ( "code-d.restartServer" , ( ) => {
122126 workspaced . restartServer ( ) . then ( ( res ) => {
123127 vscode . window . showInformationMessage ( "Restarted DCD-Server" ) ;
124128 } , ( err ) => {
125129 console . error ( err ) ;
126130 vscode . window . showErrorMessage ( "Failed to kill DCD-Server. See console for details." ) ;
127131 } ) ;
128- } ) ;
132+ } ) ) ;
129133
130- vscode . commands . registerCommand ( "code-d.reloadImports" , ( ) => {
134+ context . subscriptions . push ( vscode . commands . registerCommand ( "code-d.reloadImports" , ( ) => {
131135 workspaced . updateImports ( ) . then ( ( success ) => {
132136 if ( success )
133137 vscode . window . showInformationMessage ( "Successfully reloaded import paths" ) ;
@@ -136,7 +140,7 @@ export function activate(context: vscode.ExtensionContext) {
136140 } , ( err ) => {
137141 vscode . window . showErrorMessage ( "Could not update imports. dub might not be initialized yet!" ) ;
138142 } ) ;
139- } ) ;
143+ } ) ) ;
140144
141145 console . log ( "Initialized code-d" ) ;
142146}
0 commit comments