@@ -262,6 +262,34 @@ json::Value toJSON(const BreakpointLocationsResponseBody &BLRB) {
262
262
return json::Object{{" breakpoints" , BLRB.breakpoints }};
263
263
}
264
264
265
+ bool fromJSON (const json::Value &Params, Console &C, json::Path P) {
266
+ auto oldFormatConsole = Params.getAsBoolean ();
267
+ if (oldFormatConsole) {
268
+ C = *oldFormatConsole ? eConsoleIntegratedTerminal : eConsoleInternal;
269
+ return true ;
270
+ }
271
+ auto newFormatConsole = Params.getAsString ();
272
+ if (!newFormatConsole) {
273
+ P.report (" expected a string" );
274
+ return false ;
275
+ }
276
+
277
+ std::optional<Console> console =
278
+ StringSwitch<std::optional<Console>>(*newFormatConsole)
279
+ .Case (" internalConsole" , eConsoleInternal)
280
+ .Case (" integratedTerminal" , eConsoleIntegratedTerminal)
281
+ .Case (" externalTerminal" , eConsoleExternalTerminal)
282
+ .Default (std::nullopt );
283
+ if (!console) {
284
+ P.report (" unexpected value, expected 'internalConsole', "
285
+ " 'integratedTerminal' or 'externalTerminal'" );
286
+ return false ;
287
+ }
288
+
289
+ C = *console;
290
+ return true ;
291
+ }
292
+
265
293
bool fromJSON (const json::Value &Params, LaunchRequestArguments &LRA,
266
294
json::Path P) {
267
295
json::ObjectMapper O (Params, P);
@@ -273,9 +301,8 @@ bool fromJSON(const json::Value &Params, LaunchRequestArguments &LRA,
273
301
O.mapOptional (" disableASLR" , LRA.disableASLR ) &&
274
302
O.mapOptional (" disableSTDIO" , LRA.disableSTDIO ) &&
275
303
O.mapOptional (" shellExpandArguments" , LRA.shellExpandArguments ) &&
276
-
277
- O.mapOptional (" runInTerminal" , LRA.runInTerminal ) &&
278
- parseEnv (Params, LRA.env , P);
304
+ O.mapOptional (" runInTerminal" , LRA.console ) &&
305
+ O.mapOptional (" console" , LRA.console ) && parseEnv (Params, LRA.env , P);
279
306
}
280
307
281
308
bool fromJSON (const json::Value &Params, AttachRequestArguments &ARA,
0 commit comments