refactor(api): consistent VALIDATE messages #22262

Problem:
Validation messages are not consistently formatted.
- Parameter names sometimes are NOT quoted.
- Descriptive names (non-parameters) sometimes ARE quoted.

Solution:
Always quote the `name` value passed to a VALIDATE macro _unless_ the
value has whitespace.
This commit is contained in:
Justin M. Keyes
2023-02-14 14:19:28 -05:00
committed by GitHub
parent e03ecb7d31
commit 556f8646c0
18 changed files with 215 additions and 139 deletions

View File

@@ -207,7 +207,7 @@ Boolean nvim_buf_attach(uint64_t channel_id, Buffer buffer, Boolean send_buffer,
}
}
VALIDATE_S(key_used, "key", k.data, {
VALIDATE_S(key_used, "'opts' key", k.data, {
goto error;
});
}
@@ -1074,7 +1074,7 @@ void nvim_buf_delete(Buffer buffer, Dictionary opts, Error *err)
} else if (strequal("unload", k.data)) {
unload = api_object_to_bool(v, "unload", false, err);
} else {
VALIDATE_S(false, "key", k.data, {
VALIDATE_S(false, "'opts' key", k.data, {
return;
});
}