1
1
import * as vscode from 'vscode' ;
2
2
import { CastleConfiguration , CastleBuildModes } from './castleConfiguration' ;
3
+ import { CastlePascalLanguageServer } from './castlePascalLanguageServer' ;
4
+ import { CastleTaskProvider } from './castleTaskProvider' ;
3
5
import * as castlePath from './castlePath' ;
4
6
5
- export class CastleStatusBar {
6
- private _castleConfig ;
7
- private _context ;
8
- private _castleLanguageServer ;
9
- private _castleTaskProvider ;
7
+ export class CastleStatusBar
8
+ {
9
+ private _castleConfig : CastleConfiguration ;
10
+ private _context : vscode . ExtensionContext ;
11
+ private _castleLanguageServer : CastlePascalLanguageServer ;
12
+ private _castleTaskProvider : CastleTaskProvider ;
10
13
private _buildModesButton : vscode . StatusBarItem ;
11
14
private _compileButton : vscode . StatusBarItem ;
12
15
private _runButton : vscode . StatusBarItem ;
@@ -17,12 +20,9 @@ export class CastleStatusBar {
17
20
18
21
/**
19
22
* Constructor
20
- * @param {vscode.ExtensionContext } context
21
- * @param {castleConfiguration.CastleConfiguration } castleConfig
22
- * @param {castleLanguageServer.castleLanguageServer } castleLanguageServer
23
- * @param {CastleTaskProvider.castleTaskProvider } castleTaskProvider
24
23
*/
25
- constructor ( context , castleConfig , castleLanguageServer , castleTaskProvider ) {
24
+ constructor ( context : vscode . ExtensionContext , castleConfig : CastleConfiguration , castleLanguageServer : CastlePascalLanguageServer , castleTaskProvider : CastleTaskProvider )
25
+ {
26
26
this . _castleConfig = castleConfig ;
27
27
this . _context = context ;
28
28
this . _castleLanguageServer = castleLanguageServer ;
@@ -37,7 +37,8 @@ export class CastleStatusBar {
37
37
this . updateButtonsVisibility ( ) ;
38
38
}
39
39
40
- createBuildModeSwitch ( ) {
40
+ private createBuildModeSwitch ( ) : void
41
+ {
41
42
let command = vscode . commands . registerCommand ( this . _castleConfig . commandId . showBuildModes , async ( ) => {
42
43
const chosenBuildMode = await vscode . window . showQuickPick ( [ 'Debug' , 'Release' ] , { placeHolder : 'Select build type' } ) ;
43
44
if ( ! chosenBuildMode === undefined ) {
@@ -61,11 +62,13 @@ export class CastleStatusBar {
61
62
this . _buildModesButton . tooltip = 'Click to select build mode (debug or release)' ;
62
63
}
63
64
64
- updateBuildModesButtonText ( ) {
65
+ private updateBuildModesButtonText ( ) : void
66
+ {
65
67
this . _buildModesButton . text = 'CGE: [' + this . _castleConfig . buildMode . name + ']' ;
66
68
}
67
69
68
- createCompileButton ( ) {
70
+ private createCompileButton ( ) : void
71
+ {
69
72
this . _compileButton = vscode . window . createStatusBarItem ( vscode . StatusBarAlignment . Left , 19 ) ;
70
73
this . _context . subscriptions . push ( this . _compileButton ) ;
71
74
this . _compileButton . command = this . _castleConfig . commandId . compile ;
@@ -74,7 +77,8 @@ export class CastleStatusBar {
74
77
this . _compileButton . show ( ) ;
75
78
}
76
79
77
- createDebugButton ( ) {
80
+ private createDebugButton ( ) : void
81
+ {
78
82
this . _debugButton = vscode . window . createStatusBarItem ( vscode . StatusBarAlignment . Left , 18 ) ;
79
83
this . _context . subscriptions . push ( this . _runButton ) ;
80
84
this . _debugButton . command = this . _castleConfig . commandId . debug ;
@@ -83,7 +87,8 @@ export class CastleStatusBar {
83
87
this . _debugButton . show ( ) ;
84
88
}
85
89
86
- createRunButton ( ) {
90
+ private createRunButton ( ) : void
91
+ {
87
92
this . _runButton = vscode . window . createStatusBarItem ( vscode . StatusBarAlignment . Left , 18 ) ;
88
93
this . _context . subscriptions . push ( this . _runButton ) ;
89
94
this . _runButton . command = this . _castleConfig . commandId . run ;
@@ -92,7 +97,8 @@ export class CastleStatusBar {
92
97
this . _runButton . show ( ) ;
93
98
}
94
99
95
- createCleanButton ( ) {
100
+ private createCleanButton ( ) : void
101
+ {
96
102
this . _cleanButton = vscode . window . createStatusBarItem ( vscode . StatusBarAlignment . Left , 18 ) ;
97
103
this . _context . subscriptions . push ( this . _cleanButton ) ;
98
104
this . _cleanButton . command = this . _castleConfig . commandId . clean ;
@@ -101,7 +107,8 @@ export class CastleStatusBar {
101
107
this . _cleanButton . show ( ) ;
102
108
}
103
109
104
- createOpenInEditorButton ( ) {
110
+ private createOpenInEditorButton ( ) : void
111
+ {
105
112
this . _openInEditorButton = vscode . window . createStatusBarItem ( vscode . StatusBarAlignment . Left , 18 ) ;
106
113
this . _context . subscriptions . push ( this . _openInEditorButton ) ;
107
114
this . _openInEditorButton . command = this . _castleConfig . commandId . openInCastleEditor ;
@@ -110,7 +117,8 @@ export class CastleStatusBar {
110
117
this . _openInEditorButton . show ( ) ;
111
118
}
112
119
113
- createConfigErrorButton ( ) {
120
+ private createConfigErrorButton ( ) : void
121
+ {
114
122
this . _openSettingsButton = vscode . window . createStatusBarItem ( vscode . StatusBarAlignment . Left , 18 ) ;
115
123
this . _context . subscriptions . push ( this . _openSettingsButton ) ;
116
124
this . _openSettingsButton . command = this . _castleConfig . commandId . validateAndOpenSettings ;
@@ -120,7 +128,8 @@ export class CastleStatusBar {
120
128
this . _openSettingsButton . show ( ) ;
121
129
}
122
130
123
- updateButtonsVisibility ( ) {
131
+ private updateButtonsVisibility ( ) : void
132
+ {
124
133
let cgeFolder = castlePath . bestWorkspaceFolderStrict ( ) ;
125
134
if ( cgeFolder === undefined ) {
126
135
/* Not a CGE project, so don't show any status buttons.
0 commit comments