Skip to content

Commit

Permalink
nixd/Server/configuration: log when workspace/configuration respons…
Browse files Browse the repository at this point in the history
…e is not array
  • Loading branch information
jonathanjameswatson committed Oct 11, 2023
1 parent 3fc4cd4 commit 0d2041d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion nixd/lib/Server/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,16 @@ void Controller::fetchConfig() {
lspserver::ConfigurationItem{.section = "nixd"}}},
[this](llvm::Expected<OptionalValue> Response) {
if (Response) {
const llvm::json::Value ResponseValue =
Response.get().Value.value();
if (ResponseValue.kind() != llvm::json::Value::Array) {
lspserver::elog(
"workspace/configuration response is not an array: {0}",
ResponseValue);
return;
}
const llvm::json::Value FirstConfig =
Response.get().Value.value().getAsArray()->front();
ResponseValue.getAsArray()->front();
if (FirstConfig.kind() == llvm::json::Value::Null) {
lspserver::log("workspace/configuration is not set");
return;
Expand Down

0 comments on commit 0d2041d

Please sign in to comment.