================ @@ -23,6 +24,75 @@ bool fromJSON(const json::Value &Params, DisconnectArguments &DA, O.mapOptional("suspendDebuggee", DA.suspendDebuggee); } +bool fromJSON(const llvm::json::Value &Params, + InitializeRequestArguments::PathFormat &PF, llvm::json::Path P) { + auto rawPathFormat = Params.getAsString(); + if (!rawPathFormat) { + P.report("expected a string"); + return false; + } + + std::optional<InitializeRequestArguments::PathFormat> pathFormat = + StringSwitch<std::optional<InitializeRequestArguments::PathFormat>>( + *rawPathFormat) + .Case("path", InitializeRequestArguments::PathFormat::path) + .Case("uri", InitializeRequestArguments::PathFormat::uri) + .Default(std::nullopt); + if (!pathFormat) { + P.report("unexpected value, expected 'path' or 'uri'"); + return false; + } + + PF = *pathFormat; + return true; +} + +bool fromJSON(const llvm::json::Value &Params, InitializeRequestArguments &IRA, + llvm::json::Path P) { + json::ObjectMapper OM(Params, P); + if (!OM) + return false; + + const json::Object *O = Params.getAsObject(); + if (std::optional<bool> v = O->getBoolean("supportsVariableType"); v && *v) + IRA.supportedFeatures.insert(ClientFeature::supportsVariableType); ---------------- JDevlieghere wrote:
This seems like an opportunity for a for-loop that iterates over a `std::pair<lllvm::StringLiteral, ClientFeature>`. https://github.com/llvm/llvm-project/pull/133007 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits