mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
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:
@@ -36,7 +36,7 @@ static int validate_option_value_args(Dict(option) *opts, int *scope, int *opt_t
|
||||
} else if (!strcmp(opts->scope.data.string.data, "global")) {
|
||||
*scope = OPT_GLOBAL;
|
||||
} else {
|
||||
VALIDATE(false, "%s", "Invalid scope: expected 'local' or 'global'", {
|
||||
VALIDATE_EXP(false, "scope", "'local' or 'global'", NULL, {
|
||||
return FAIL;
|
||||
});
|
||||
}
|
||||
@@ -197,7 +197,7 @@ void nvim_set_option_value(String name, Object value, Dict(option) *opts, Error
|
||||
scope |= OPT_CLEAR;
|
||||
break;
|
||||
default:
|
||||
VALIDATE_EXP(false, "option type", "Integer, Boolean, or String", api_typename(value.type), {
|
||||
VALIDATE_EXP(false, name.data, "Integer/Boolean/String", api_typename(value.type), {
|
||||
return;
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user