@@ -4,16 +4,16 @@ import Instance from "../Instance";
4
4
import path from "path" ;
5
5
import * as vscode from 'vscode' ;
6
6
7
- import { instance } from "../instantiate" ;
8
- import { ObjectItem } from "../typings" ;
9
7
import { ILELibrarySettings } from "../api/CompileTools" ;
8
+ import { getDebugServiceDetails , ORIGINAL_DEBUG_CONFIG_FILE , resetDebugServiceDetails } from "../api/configuration/DebugConfiguration" ;
9
+ import IBMi from "../api/IBMi" ;
10
+ import { getStoredPassword } from "../config/passwords" ;
10
11
import { Env , getEnvConfig } from "../filesystems/local/env" ;
12
+ import { instance } from "../instantiate" ;
13
+ import { ObjectItem } from "../typings" ;
14
+ import { VscodeTools } from "../ui/Tools" ;
11
15
import * as certificates from "./certificates" ;
12
- import { DebugConfiguration , getDebugServiceDetails , ORIGINAL_DEBUG_CONFIG_FILE , resetDebugServiceDetails } from "../api/configuration/DebugConfiguration" ;
13
16
import * as server from "./server" ;
14
- import { VscodeTools } from "../ui/Tools" ;
15
- import { getStoredPassword } from "../config/passwords" ;
16
- import IBMi from "../api/IBMi" ;
17
17
18
18
const debugExtensionId = `IBM.ibmidebug` ;
19
19
@@ -297,51 +297,55 @@ export async function initialize(context: ExtensionContext) {
297
297
activateDebugExtension ( ) ;
298
298
const connection = instance . getConnection ( ) ;
299
299
if ( connection ) {
300
- if ( await server . isDebugSupported ( connection ) ) {
301
- vscode . commands . executeCommand ( `setContext` , ptfContext , true ) ;
300
+ const debuggerInstalled = server . debugPTFInstalled ( connection ) ;
301
+ const debugDetails = await getDebugServiceDetails ( connection ) ;
302
+ if ( debuggerInstalled ) {
303
+ if ( debugDetails . semanticVersion ( ) . major >= server . MIN_DEBUG_VERSION ) {
304
+ vscode . commands . executeCommand ( `setContext` , ptfContext , true ) ;
302
305
303
- //Enable debug related commands
304
- vscode . commands . executeCommand ( `setContext` , debugContext , true ) ;
306
+ //Enable debug related commands
307
+ vscode . commands . executeCommand ( `setContext` , debugContext , true ) ;
305
308
306
- //Enable service entry points related commands
307
- vscode . commands . executeCommand ( `setContext` , debugSEPContext , true ) ;
309
+ //Enable service entry points related commands
310
+ vscode . commands . executeCommand ( `setContext` , debugSEPContext , true ) ;
308
311
309
- const isDebugManaged = isManaged ( ) ;
310
- vscode . commands . executeCommand ( `setContext` , `code-for-ibmi:debugManaged` , isDebugManaged ) ;
311
- if ( ! isDebugManaged ) {
312
- if ( validateIPv4address ( connection . currentHost ) ) {
313
- vscode . window . showWarningMessage ( `You are using an IPv4 address to connect to this system. This may cause issues with debugging. Please use a hostname in the Login Settings instead.` ) ;
314
- }
312
+ const isDebugManaged = isManaged ( ) ;
313
+ vscode . commands . executeCommand ( `setContext` , `code-for-ibmi:debugManaged` , isDebugManaged ) ;
315
314
316
- // Set the debug environment variables early to be safe
317
- setCertEnv ( true , connection ) ;
315
+ if ( ! isDebugManaged ) {
316
+ if ( validateIPv4address ( connection . currentHost ) ) {
317
+ vscode . window . showWarningMessage ( `You are using an IPv4 address to connect to this system. This may cause issues with debugging. Please use a hostname in the Login Settings instead.` ) ;
318
+ }
318
319
319
- // Download the client certificate if it doesn't exist.
320
- certificates . checkClientCertificate ( connection ) . catch ( ( ) => {
321
- vscode . commands . executeCommand ( `code-for-ibmi.debug.setup.local` ) ;
322
- } ) ;
320
+ // Set the debug environment variables early to be safe
321
+ setCertEnv ( true , connection ) ;
323
322
324
- }
325
- } else {
326
- const version = ( await getDebugServiceDetails ( connection ) ) . semanticVersion ( ) ;
327
- const storage = instance . getStorage ( ) ;
328
- if ( storage && version . major < server . MIN_DEBUG_VERSION ) {
329
- const debugUpdateMessageId = `debugUpdateRequired-${ server . MIN_DEBUG_VERSION } ` ;
330
- const showMessage = ! storage . hasMessageBeenShown ( debugUpdateMessageId ) ;
331
-
332
- if ( showMessage ) {
333
- vscode . window . showWarningMessage ( `Debug service version ${ version } is below the minimum required version ${ server . MIN_DEBUG_VERSION } . Please update the debug service PTF.` , `Open docs` , `Dismiss` ) . then ( selected => {
334
- switch ( selected ) {
335
- case `Open docs` :
336
- env . openExternal ( Uri . parse ( `https://codefori.github.io/docs/developing/debug/` ) ) ;
337
- break ;
338
- case `Dismiss` :
339
- storage . markMessageAsShown ( debugUpdateMessageId ) ;
340
- break ;
341
- }
323
+ // Download the client certificate if it doesn't exist.
324
+ certificates . checkClientCertificate ( connection ) . catch ( ( ) => {
325
+ vscode . commands . executeCommand ( `code-for-ibmi.debug.setup.local` ) ;
342
326
} ) ;
343
327
}
344
328
}
329
+ else {
330
+ const storage = instance . getStorage ( ) ;
331
+ if ( storage && debugDetails . semanticVersion ( ) . major < server . MIN_DEBUG_VERSION ) {
332
+ const debugUpdateMessageId = `debugUpdateRequired-${ server . MIN_DEBUG_VERSION } ` ;
333
+ const showMessage = ! storage . hasMessageBeenShown ( debugUpdateMessageId ) ;
334
+
335
+ if ( showMessage ) {
336
+ vscode . window . showWarningMessage ( `Debug service version ${ debugDetails . version } is below the minimum required version ${ server . MIN_DEBUG_VERSION } .0.0. Please update the debug service PTF.` , `Open docs` , `Dismiss` ) . then ( selected => {
337
+ switch ( selected ) {
338
+ case `Open docs` :
339
+ env . openExternal ( Uri . parse ( `https://codefori.github.io/docs/developing/debug/` ) ) ;
340
+ break ;
341
+ case `Dismiss` :
342
+ storage . markMessageAsShown ( debugUpdateMessageId ) ;
343
+ break ;
344
+ }
345
+ } ) ;
346
+ }
347
+ }
348
+ }
345
349
}
346
350
}
347
351
} ) ;
@@ -395,7 +399,7 @@ export async function startDebug(instance: Instance, options: DebugOptions) {
395
399
secure = setCertEnv ( secure , connection ) ;
396
400
397
401
if ( options . sep ) {
398
- if ( serviceDetails . version === `1.0.0` ) {
402
+ if ( serviceDetails . semanticVersion ( ) . major < 2 ) {
399
403
vscode . window . showErrorMessage ( `The debug service on this system, version ${ serviceDetails . version } , does not support service entry points.` ) ;
400
404
return ;
401
405
}
0 commit comments