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:
committed by
Bram Moolenaar
parent
7a411a306f
commit
4829c1c9e9
@@ -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]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user