1
1
import { ExtensionContext , Uri } from "vscode" ;
2
2
import Instance from "../Instance" ;
3
3
4
- import * as vscode from 'vscode' ;
5
4
import path from "path" ;
5
+ import * as vscode from 'vscode' ;
6
6
7
- import * as certificates from "./certificates" ;
8
- import * as server from "./server" ;
9
7
import { copyFileSync } from "fs" ;
10
8
import { instance } from "../../instantiate" ;
11
- import { getEnvConfig } from "../local/env" ;
12
9
import { ILELibrarySettings } from "../CompileTools" ;
10
+ import { getEnvConfig } from "../local/env" ;
11
+ import * as certificates from "./certificates" ;
12
+ import * as server from "./server" ;
13
13
14
14
const debugExtensionId = `IBM.ibmidebug` ;
15
15
@@ -60,7 +60,7 @@ export async function initialize(context: ExtensionContext) {
60
60
61
61
if ( config . debugIsSecure && ! isManaged ( ) ) {
62
62
if ( ! await certificates . localClientCertExists ( connection ) ) {
63
- vscode . window . showInformationMessage ( `Debug Service Certificates ` , {
63
+ vscode . window . showInformationMessage ( `Debug Service Certificate ` , {
64
64
modal : true ,
65
65
detail : `Debug client certificate is not setup.`
66
66
} ,
@@ -102,7 +102,7 @@ export async function initialize(context: ExtensionContext) {
102
102
detail : `The IBM i Debug extension is not installed. It can be installed from the Marketplace.` ,
103
103
modal : true
104
104
} , `Go to Marketplace` ) . then ( result => {
105
- if ( result === `Go to Marketplace` ) {
105
+ if ( result ) {
106
106
vscode . commands . executeCommand ( 'code-for-ibmi.debug.extension' ) ;
107
107
}
108
108
} ) ;
@@ -230,8 +230,7 @@ export async function initialize(context: ExtensionContext) {
230
230
const ptfInstalled = debugPTFInstalled ( ) ;
231
231
232
232
if ( ptfInstalled ) {
233
- const remoteCertExists = await certificates . remoteServerCertExists ( connection ) ;
234
- let remoteCertsAreNew = false ;
233
+ const remoteCertExists = await certificates . remoteServerCertificateExists ( connection ) ;
235
234
let remoteCertsOk = false ;
236
235
237
236
if ( remoteCertExists ) {
@@ -243,8 +242,8 @@ export async function initialize(context: ExtensionContext) {
243
242
const doSetup = await vscode . window . showInformationMessage ( `Debug setup` , {
244
243
modal : true ,
245
244
detail : `${ remoteCertExists
246
- ? `Debug certificates already exist on this system! This will download the client certificates to enable secure debugging.`
247
- : `Debug certificates are not setup on the system. This will generate the certificates and download them to your device.`
245
+ ? `Debug service certificate already exist on this system! This will download the client certificate to enable secure debugging.`
246
+ : `Debug service certificate is not setup on the system. This will generate the server certificate and download the client certificate to your device.`
248
247
} Continue with setup?`
249
248
} , `Continue` ) ;
250
249
@@ -253,9 +252,8 @@ export async function initialize(context: ExtensionContext) {
253
252
// If the remote certs don't exist, generate them
254
253
if ( ! remoteCertExists ) {
255
254
await certificates . setup ( connection ) ;
256
- vscode . window . showInformationMessage ( `Certificates successfully generated on server.` ) ;
255
+ vscode . window . showInformationMessage ( `Certificate successfully generated on server.` ) ;
257
256
remoteCertsOk = true ;
258
- remoteCertsAreNew = true ;
259
257
}
260
258
} catch ( e : any ) {
261
259
vscode . window . showErrorMessage ( e . message || e ) ;
@@ -286,34 +284,34 @@ export async function initialize(context: ExtensionContext) {
286
284
287
285
try {
288
286
const existingDebugService = await server . getRunningJob ( connection . config ?. debugPort || "8005" , instance . getContent ( ) ! ) ;
289
- const remoteCertExists = await certificates . remoteServerCertExists ( connection ) ;
287
+ const remoteCertExists = await certificates . remoteServerCertificateExists ( connection ) ;
290
288
291
289
// If the client certificate exists on the server, download it
292
290
if ( remoteCertExists ) {
293
291
if ( existingDebugService ) {
294
292
await certificates . downloadClientCert ( connection ) ;
295
293
localCertsOk = true ;
296
- vscode . window . showInformationMessage ( `Debug certificate downloaded from the server.` ) ;
294
+ vscode . window . showInformationMessage ( `Debug client certificate downloaded from the server.` ) ;
297
295
} else {
298
296
vscode . window . showInformationMessage ( `Cannot fetch client certificate because the Debug Service is not running.` , `Startup Service` ) . then ( result => {
299
- if ( result === `Startup Service` ) {
297
+ if ( result ) {
300
298
vscode . commands . executeCommand ( `code-for-ibmi.debug.start` ) ;
301
299
}
302
300
} ) ;
303
301
}
304
-
305
302
} else {
306
303
const doImport = await vscode . window . showInformationMessage ( `Debug setup` , {
307
304
modal : true ,
308
- detail : `The server certificate is not setup on the server. Would you like to import a certificate from your device?`
305
+ detail : `The debug service certificate is not setup on the server. Would you like to import a server certificate from your device?`
309
306
} , `Yes` , `No` ) ;
310
307
311
308
if ( doImport === `Yes` ) {
312
309
const selectedFile = await vscode . window . showOpenDialog ( {
313
310
canSelectFiles : true ,
314
311
canSelectFolders : false ,
315
312
canSelectMany : false ,
316
- title : `Select debug client certificate`
313
+ title : `Select debug service certificate` ,
314
+ filters : { "PFX certificate" : [ "pfx" ] }
317
315
} ) ;
318
316
319
317
if ( selectedFile && selectedFile . length === 1 ) {
@@ -328,7 +326,7 @@ export async function initialize(context: ExtensionContext) {
328
326
}
329
327
} else {
330
328
vscode . window . showInformationMessage ( `Import of debug client certificate skipped as not required in current mode.` , `Open configuration` ) . then ( result => {
331
- if ( result === `Open configuration` ) {
329
+ if ( result ) {
332
330
vscode . commands . executeCommand ( `code-for-ibmi.showAdditionalSettings` , undefined , `Debugger` ) ;
333
331
}
334
332
} ) ;
@@ -348,7 +346,7 @@ export async function initialize(context: ExtensionContext) {
348
346
if ( connection ) {
349
347
const ptfInstalled = debugPTFInstalled ( ) ;
350
348
if ( ptfInstalled ) {
351
- const remoteExists = await certificates . remoteServerCertExists ( connection ) ;
349
+ const remoteExists = await certificates . remoteServerCertificateExists ( connection ) ;
352
350
if ( remoteExists ) {
353
351
vscode . window . withProgress ( { location : vscode . ProgressLocation . Notification } , async ( progress ) => {
354
352
@@ -429,7 +427,7 @@ export async function initialize(context: ExtensionContext) {
429
427
430
428
await certificates . legacyCertificateChecks ( connection , existingDebugService ) ;
431
429
432
- const remoteCertsExist = await certificates . remoteServerCertExists ( connection ) ;
430
+ const remoteCertsExist = await certificates . remoteServerCertificateExists ( connection ) ;
433
431
434
432
if ( remoteCertsExist ) {
435
433
vscode . commands . executeCommand ( `setContext` , remoteCertContext , true ) ;
@@ -449,7 +447,7 @@ export async function initialize(context: ExtensionContext) {
449
447
`Looks like you have the debug PTF but don't have it configured.`
450
448
} Do you want to see the Walkthrough to set it up?`, `Take me there` ) ;
451
449
452
- if ( openTut === `Take me there` ) {
450
+ if ( openTut ) {
453
451
vscode . commands . executeCommand ( `workbench.action.openWalkthrough` , `halcyontechltd.vscode-ibmi-walkthroughs#code-ibmi-debug` ) ;
454
452
}
455
453
}
0 commit comments