@@ -14,26 +14,32 @@ function createDefaultLLDBDapOptions(): LLDBDapOptions {
1414 session : vscode . DebugSession ,
1515 packageJSONExecutable : vscode . DebugAdapterExecutable | undefined ,
1616 ) : Promise < vscode . DebugAdapterExecutable | undefined > {
17- const config = vscode . workspace
18- . getConfiguration ( "lldb-dap" , session . workspaceFolder ) ;
17+ const config = vscode . workspace . getConfiguration (
18+ "lldb-dap" ,
19+ session . workspaceFolder ,
20+ ) ;
1921 const path = config . get < string > ( "executable-path" ) ;
2022 const log_path = config . get < string > ( "log-path" ) ;
2123
22- let env : { [ key : string ] : string } = { } ;
24+ let env : { [ key : string ] : string } = { } ;
2325 if ( log_path ) {
2426 env [ "LLDBDAP_LOG" ] = log_path ;
2527 }
2628
2729 if ( path ) {
28- return new vscode . DebugAdapterExecutable ( path , [ ] , { env} ) ;
30+ return new vscode . DebugAdapterExecutable ( path , [ ] , { env } ) ;
2931 } else if ( packageJSONExecutable ) {
30- return new vscode . DebugAdapterExecutable ( packageJSONExecutable . command , packageJSONExecutable . args , {
31- ...packageJSONExecutable . options ,
32- env : {
33- ...packageJSONExecutable . options ?. env ,
34- ...env
35- }
36- } ) ;
32+ return new vscode . DebugAdapterExecutable (
33+ packageJSONExecutable . command ,
34+ packageJSONExecutable . args ,
35+ {
36+ ...packageJSONExecutable . options ,
37+ env : {
38+ ...packageJSONExecutable . options ?. env ,
39+ ...env ,
40+ } ,
41+ } ,
42+ ) ;
3743 } else {
3844 return undefined ;
3945 }
@@ -58,6 +64,26 @@ export class LLDBDapExtension extends DisposableContext {
5864 new LLDBDapDescriptorFactory ( this . lldbDapOptions ) ,
5965 ) ,
6066 ) ;
67+
68+ this . pushSubscription (
69+ vscode . workspace . onDidChangeConfiguration ( async ( event ) => {
70+ if ( event . affectsConfiguration ( "lldb-dap.executable-path" ) ) {
71+ const dapPath = vscode . workspace
72+ . getConfiguration ( "lldb-dap" )
73+ . get < string > ( "executable-path" ) ;
74+
75+ if ( dapPath ) {
76+ const fileUri = vscode . Uri . file ( dapPath ) ;
77+ if (
78+ await LLDBDapDescriptorFactory . isValidDebugAdapterPath ( fileUri )
79+ ) {
80+ return ;
81+ }
82+ }
83+ LLDBDapDescriptorFactory . showLLDBDapNotFoundMessage ( dapPath || "" ) ;
84+ }
85+ } ) ,
86+ ) ;
6187 }
6288}
6389
0 commit comments