Skip to content

Commit d3a6ff3

Browse files
committed
Cleanup some null vs undefined usage, now important after using ===
1 parent 6ae205e commit d3a6ff3

File tree

4 files changed

+11
-21
lines changed

4 files changed

+11
-21
lines changed

src/castleDebugProvider.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,13 @@ const castlePath = require('./castlePath.js');
1111
*/
1212
export class CastleDebugProvider implements vscode.DebugConfigurationProvider
1313
{
14-
private _castleConfig;
14+
private _castleConfig: CastleConfiguration;
1515

16-
/**
17-
* @param {castleConfiguration.CastleConfiguration} castleConfig
18-
*/
19-
constructor(castleConfig) {
16+
constructor(castleConfig: CastleConfiguration) {
2017
this._castleConfig = castleConfig;
2118
}
2219

23-
// not used
24-
/*provideDebugConfigurations(folder, token) {
25-
console.log('provideDebugConfigurations - START');
26-
}*/
27-
28-
async resolveDebugConfiguration(folder, config /*, token*/) {
20+
async resolveDebugConfiguration(folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration /*, token*/) {
2921
console.log('CastleDebugProvider.resolveDebugConfiguration');
3022

3123
if ((config.type === undefined) &&

src/castlePascalLanguageServer.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ import * as castlePath from './castlePath';
99
*/
1010
export class CastlePascalLanguageServer {
1111
private _castleConfig;
12-
private _pascalServerClient;
12+
private _pascalServerClient : LanguageClient | null = null;
1313
private _environmentForPascalServer;
1414

1515
/**
1616
* @param {castleConfiguration.CastleConfiguration} castleConfig
1717
*/
1818
constructor(castleConfig: CastleConfiguration) {
1919
this._castleConfig = castleConfig;
20-
this._pascalServerClient = null;
2120
}
2221

2322
/**
@@ -134,7 +133,7 @@ export class CastlePascalLanguageServer {
134133
* Destroys _pascalServerClient. Used when configuration changes.
135134
*/
136135
async destroyLanguageClient() {
137-
if (this._pascalServerClient !== undefined) {
136+
if (this._pascalServerClient !== null) {
138137
try {
139138
await this._pascalServerClient.stop();
140139

src/castlePlugin.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export class CastlePlugin
3838
this._editorCommandsRegistered = false;
3939
this._searchInApiReferenceCommandsRegistered = false;
4040
this._validateCommandsRegistered = false;
41-
this._referencePanel = null;
4241
}
4342

4443
/**
@@ -159,13 +158,13 @@ export class CastlePlugin
159158
if (this._taskCommandsRegistered === true) {
160159
// when there is no build tool available
161160
this._disposableCompile.dispose();
162-
this._disposableCompile = null;
161+
this._disposableCompile = undefined;
163162

164163
this._disposableRun.dispose();
165-
this._disposableRun = null;
164+
this._disposableRun = undefined;
166165

167166
this._disposableClean.dispose();
168-
this._disposableClean = null;
167+
this._disposableClean = undefined;
169168

170169
this._taskCommandsRegistered = false;
171170
}
@@ -180,7 +179,7 @@ export class CastlePlugin
180179
if (this._castleConfig.buildToolPath === '') {
181180
if (this._editorCommandsRegistered) {
182181
this._disposableOpenInEditor.dispose();
183-
this._disposableOpenInEditor = null;
182+
this._disposableOpenInEditor = undefined;
184183
this._editorCommandsRegistered = false;
185184
}
186185
} else {

src/castleStatusBar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ export class CastleStatusBar {
157157
this._cleanButton.show();
158158
this._openInEditorButton.show();
159159

160-
// when pascalServerPath is valid but pascalServerClient is undefined or null
160+
// when pascalServerPath is valid but pascalServerClient is null
161161
// there is problem with pasls config
162-
if ((this._castleConfig.pascalServerPath !== '') && (this._castleLanguageServer.pascalServerClient === undefined)) {
162+
if ((this._castleConfig.pascalServerPath !== '') && (this._castleLanguageServer.pascalServerClient === null)) {
163163
this._openSettingsButton.show();
164164
} else {
165165
this._openSettingsButton.hide();

0 commit comments

Comments
 (0)