@@ -14,26 +14,32 @@ function createDefaultLLDBDapOptions(): LLDBDapOptions {
14
14
session : vscode . DebugSession ,
15
15
packageJSONExecutable : vscode . DebugAdapterExecutable | undefined ,
16
16
) : 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
+ ) ;
19
21
const path = config . get < string > ( "executable-path" ) ;
20
22
const log_path = config . get < string > ( "log-path" ) ;
21
23
22
- let env : { [ key : string ] : string } = { } ;
24
+ let env : { [ key : string ] : string } = { } ;
23
25
if ( log_path ) {
24
26
env [ "LLDBDAP_LOG" ] = log_path ;
25
27
}
26
28
27
29
if ( path ) {
28
- return new vscode . DebugAdapterExecutable ( path , [ ] , { env} ) ;
30
+ return new vscode . DebugAdapterExecutable ( path , [ ] , { env } ) ;
29
31
} 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
+ ) ;
37
43
} else {
38
44
return undefined ;
39
45
}
@@ -58,6 +64,26 @@ export class LLDBDapExtension extends DisposableContext {
58
64
new LLDBDapDescriptorFactory ( this . lldbDapOptions ) ,
59
65
) ,
60
66
) ;
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
+ ) ;
61
87
}
62
88
}
63
89
0 commit comments