@@ -21,79 +21,97 @@ async function isServerModeSupported(exe: string): Promise<boolean> {
2121}
2222
2323interface BoolConfig {
24- type : ' boolean' ;
24+ type : " boolean" ;
2525 default : boolean ;
2626}
2727interface StringConfig {
28- type : ' string' ;
28+ type : " string" ;
2929 default : string ;
3030}
3131interface NumberConfig {
32- type : ' number' ;
32+ type : " number" ;
3333 default : number ;
3434}
3535interface StringArrayConfig {
36- type : ' stringArray' ;
36+ type : " stringArray" ;
3737 default : string [ ] ;
3838}
39- type DefaultConfig = BoolConfig | NumberConfig | StringConfig | StringArrayConfig ;
39+ type DefaultConfig =
40+ | BoolConfig
41+ | NumberConfig
42+ | StringConfig
43+ | StringArrayConfig ;
4044
4145const configurations : Record < string , DefaultConfig > = {
4246 // Keys for debugger configurations.
43- " commandEscapePrefix" : { type : "string" , default : "`" } ,
44- " customFrameFormat" : { type : "string" , default : "" } ,
45- " customThreadFormat" : { type : "string" , default : "" } ,
46- " detachOnError" : { type : "boolean" , default : false } ,
47- " disableASLR" : { type : "boolean" , default : true } ,
48- " disableSTDIO" : { type : "boolean" , default : false } ,
49- " displayExtendedBacktrace" : { type : "boolean" , default : false } ,
50- " enableAutoVariableSummaries" : { type : "boolean" , default : false } ,
51- " enableSyntheticChildDebugging" : { type : "boolean" , default : false } ,
52- " timeout" : { type : "number" , default : 30 } ,
47+ commandEscapePrefix : { type : "string" , default : "`" } ,
48+ customFrameFormat : { type : "string" , default : "" } ,
49+ customThreadFormat : { type : "string" , default : "" } ,
50+ detachOnError : { type : "boolean" , default : false } ,
51+ disableASLR : { type : "boolean" , default : true } ,
52+ disableSTDIO : { type : "boolean" , default : false } ,
53+ displayExtendedBacktrace : { type : "boolean" , default : false } ,
54+ enableAutoVariableSummaries : { type : "boolean" , default : false } ,
55+ enableSyntheticChildDebugging : { type : "boolean" , default : false } ,
56+ timeout : { type : "number" , default : 30 } ,
5357
5458 // Keys for platform / target configuration.
55- " platformName" : { type : "string" , default : "" } ,
56- " targetTriple" : { type : "string" , default : "" } ,
59+ platformName : { type : "string" , default : "" } ,
60+ targetTriple : { type : "string" , default : "" } ,
5761
5862 // Keys for debugger command hooks.
59- " initCommands" : { type : "stringArray" , default : [ ] } ,
60- " preRunCommands" : { type : "stringArray" , default : [ ] } ,
61- " postRunCommands" : { type : "stringArray" , default : [ ] } ,
62- " stopCommands" : { type : "stringArray" , default : [ ] } ,
63- " exitCommands" : { type : "stringArray" , default : [ ] } ,
64- " terminateCommands" : { type : "stringArray" , default : [ ] } ,
63+ initCommands : { type : "stringArray" , default : [ ] } ,
64+ preRunCommands : { type : "stringArray" , default : [ ] } ,
65+ postRunCommands : { type : "stringArray" , default : [ ] } ,
66+ stopCommands : { type : "stringArray" , default : [ ] } ,
67+ exitCommands : { type : "stringArray" , default : [ ] } ,
68+ terminateCommands : { type : "stringArray" , default : [ ] } ,
6569} ;
6670
6771export class LLDBDapConfigurationProvider
68- implements vscode . DebugConfigurationProvider {
69- constructor ( private readonly server : LLDBDapServer ) { }
72+ implements vscode . DebugConfigurationProvider
73+ {
74+ constructor ( private readonly server : LLDBDapServer ) { }
7075
7176 async resolveDebugConfiguration (
7277 folder : vscode . WorkspaceFolder | undefined ,
7378 debugConfiguration : vscode . DebugConfiguration ,
74- token ?: vscode . CancellationToken ) : Promise < vscode . DebugConfiguration > {
75- let config = vscode . workspace . getConfiguration ( 'lldb-dap.defaults' ) ;
79+ token ?: vscode . CancellationToken ,
80+ ) : Promise < vscode . DebugConfiguration > {
81+ let config = vscode . workspace . getConfiguration ( "lldb-dap.defaults" ) ;
7682 for ( const [ key , cfg ] of Object . entries ( configurations ) ) {
77- if ( Reflect . has ( debugConfiguration , key ) ) continue ;
83+ if ( Reflect . has ( debugConfiguration , key ) ) {
84+ continue ;
85+ }
7886 const value = config . get ( key ) ;
79- if ( value === cfg . default ) continue ;
87+ if ( ! value || value === cfg . default ) {
88+ continue ;
89+ }
8090 switch ( cfg . type ) {
81- case ' string' :
82- if ( typeof value !== ' string' )
91+ case " string" :
92+ if ( typeof value !== " string" ) {
8393 throw new Error ( `Expected ${ key } to be a string, got ${ value } ` ) ;
94+ }
8495 break ;
85- case ' number' :
86- if ( typeof value !== ' number' )
96+ case " number" :
97+ if ( typeof value !== " number" ) {
8798 throw new Error ( `Expected ${ key } to be a number, got ${ value } ` ) ;
99+ }
88100 break ;
89- case ' boolean' :
90- if ( typeof value !== ' boolean' )
101+ case " boolean" :
102+ if ( typeof value !== " boolean" ) {
91103 throw new Error ( `Expected ${ key } to be a boolean, got ${ value } ` ) ;
104+ }
92105 break ;
93- case 'stringArray' :
94- if ( typeof value !== 'object' && Array . isArray ( value ) )
95- throw new Error ( `Expected ${ key } to be a array of strings, got ${ value } ` ) ;
96- if ( ( value as string [ ] ) . length === 0 ) continue ;
106+ case "stringArray" :
107+ if ( typeof value !== "object" && Array . isArray ( value ) ) {
108+ throw new Error (
109+ `Expected ${ key } to be a array of strings, got ${ value } ` ,
110+ ) ;
111+ }
112+ if ( ( value as string [ ] ) . length === 0 ) {
113+ continue ;
114+ }
97115 break ;
98116 }
99117
0 commit comments