0
0
mirror of https://github.com/vim/vim.git synced 2025-11-15 23:14:06 -05:00

patch 8.2.4683: verbose check with dict_find() to see if a key is present

Problem:    Verbose check with dict_find() to see if a key is present.
Solution:   Add dict_has_key(). (Yegappan Lakshmanan, closes #10074)
This commit is contained in:
Yegappan Lakshmanan
2022-04-04 15:16:54 +01:00
committed by Bram Moolenaar
parent 7a411a306f
commit 4829c1c9e9
18 changed files with 95 additions and 84 deletions

View File

@@ -4460,8 +4460,7 @@ ch_expr_common(typval_T *argvars, typval_T *rettv, int eval)
}
if (argvars[2].v_type == VAR_DICT)
if (dict_find(argvars[2].vval.v_dict, (char_u *)"callback", -1)
!= NULL)
if (dict_has_key(argvars[2].vval.v_dict, "callback"))
callback_present = TRUE;
if (eval || callback_present)
@@ -4482,7 +4481,7 @@ ch_expr_common(typval_T *argvars, typval_T *rettv, int eval)
if (di != NULL)
id = di->di_tv.vval.v_number;
}
if (dict_find(d, (char_u *)"jsonrpc", -1) == NULL)
if (!dict_has_key(d, "jsonrpc"))
dict_add_string(d, "jsonrpc", (char_u *)"2.0");
text = json_encode_lsp_msg(&argvars[1]);
}