@@ -22,10 +22,10 @@ import { DebugConnector } from '../lsp/protocol';
2222import  {  extConstants  }  from  '../constants' ; 
2323import  {  l10n  }  from  '../localiser' ; 
2424import  {  StreamDebugAdapter  }  from  './streamDebugAdapter' ; 
25- import  {  globalVars  }  from  '../extension' ; 
2625import  {  extCommands ,  nbCommands  }  from  '../commands/commands' ; 
2726import  {  argumentsNode ,  environmentVariablesNode ,  vmOptionsNode ,  workingDirectoryNode  }  from  '../views/runConfiguration' ; 
2827import  {  initializeRunConfiguration  }  from  '../utils' ; 
28+ import  {  globalState  }  from  '../globalState' ; 
2929
3030export  function  registerDebugger ( context : ExtensionContext ) : void { 
3131    let  debugTrackerFactory  =  new  NetBeansDebugAdapterTrackerFactory ( ) ; 
@@ -50,8 +50,9 @@ class NetBeansDebugAdapterTrackerFactory implements vscode.DebugAdapterTrackerFa
5050    createDebugAdapterTracker ( _session : vscode . DebugSession ) : vscode . ProviderResult < vscode . DebugAdapterTracker >  { 
5151        return  { 
5252            onDidSendMessage ( message : any ) : void { 
53-                 if  ( globalVars . testAdapter  &&  message . type  ===  'event'  &&  message . event  ===  'output' )  { 
54-                     globalVars . testAdapter . testOutput ( message . body . output ) ; 
53+                 const  testAdapter  =  globalState . getTestAdapter ( ) ; 
54+                 if  ( testAdapter  &&  message . type  ===  'event'  &&  message . event  ===  'output' )  { 
55+                     testAdapter . testOutput ( message . body . output ) ; 
5556                } 
5657            } 
5758        } 
@@ -64,18 +65,18 @@ class NetBeansDebugAdapterDescriptionFactory implements vscode.DebugAdapterDescr
6465        return  new  Promise < vscode . DebugAdapterDescriptor > ( ( resolve ,  reject )  =>  { 
6566            let  cnt  =  10 ; 
6667            const  fnc  =  ( )  =>  { 
67-                 if  ( globalVars . debugPort  <  0 )  { 
68+                 if  ( globalState . getDebugPort ( )  <  0 )  { 
6869                    if  ( cnt --  >  0 )  { 
6970                        setTimeout ( fnc ,  1000 ) ; 
7071                    }  else  { 
7172                        reject ( new  Error ( l10n . value ( 'jdk.extension.debugger.error_msg.debugAdapterNotInitialized' ) ) ) ; 
7273                    } 
7374                }  else  { 
7475                    // resolve(new vscode.DebugAdapterServer(debugPort)); 
75-                     const  socket  =  net . connect ( globalVars . debugPort ,  "127.0.0.1" ,  ( )  =>  {  } ) ; 
76+                     const  socket  =  net . connect ( globalState . getDebugPort ( ) ,  "127.0.0.1" ,  ( )  =>  {  } ) ; 
7677                    socket . on ( "connect" ,  ( )  =>  { 
7778                        const  adapter  =  new  StreamDebugAdapter ( ) ; 
78-                         socket . write ( globalVars . debugHash  ?  globalVars . debugHash  :  "" ) ; 
79+                         socket . write ( globalState ?. getDebugHash ( )   ||  "" ) ; 
7980                        adapter . connect ( socket ,  socket ) ; 
8081                        resolve ( new  vscode . DebugAdapterInlineImplementation ( adapter ) ) ; 
8182                    } ) ; 
@@ -94,7 +95,7 @@ class NetBeansConfigurationInitialProvider implements vscode.DebugConfigurationP
9495    } 
9596
9697    async  doProvideDebugConfigurations ( folder : vscode . WorkspaceFolder  |  undefined ,  _token ?: vscode . CancellationToken ) : Promise < vscode . DebugConfiguration [ ] >  { 
97-         let  c : LanguageClient  =  await  globalVars . clientPromise . client ; 
98+         let  c : LanguageClient  =  await  globalState . getClientPromise ( ) . client ; 
9899        if  ( ! folder )  { 
99100            return  [ ] ; 
100101        } 
@@ -145,7 +146,7 @@ class NetBeansConfigurationDynamicProvider implements vscode.DebugConfigurationP
145146    } 
146147
147148    async  doProvideDebugConfigurations ( folder : vscode . WorkspaceFolder  |  undefined ,  context : ExtensionContext ,  commandValues : Map < string ,  string > ,  _token ?: vscode . CancellationToken ) : Promise < vscode . DebugConfiguration [ ] >  { 
148-         let  c : LanguageClient  =  await  globalVars . clientPromise . client ; 
149+         let  c : LanguageClient  =  await  globalState . getClientPromise ( ) . client ; 
149150        if  ( ! folder )  { 
150151            return  [ ] ; 
151152        } 
0 commit comments