diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-09-20 07:34:50 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2024-09-23 14:42:57 +0200 |
commit | 737f58e23230ea14f1648ac1fc7f442ea0f8563c (patch) | |
tree | d16bee4c0ad2bb5ff2ec058cd09133a285674fef /src/nvim/ui_client.c | |
parent | 5acdc4499e2036c90172b2b085f207ee4d5cfee4 (diff) | |
download | rneovim-737f58e23230ea14f1648ac1fc7f442ea0f8563c.tar.gz rneovim-737f58e23230ea14f1648ac1fc7f442ea0f8563c.tar.bz2 rneovim-737f58e23230ea14f1648ac1fc7f442ea0f8563c.zip |
refactor(api)!: rename Dictionary => Dict
In the api_info() output:
:new|put =map(filter(api_info().functions, '!has_key(v:val,''deprecated_since'')'), 'v:val')
...
{'return_type': 'ArrayOf(Integer, 2)', 'name': 'nvim_win_get_position', 'method': v:true, 'parameters': [['Window', 'window']], 'since': 1}
The `ArrayOf(Integer, 2)` return type didn't break clients when we added
it, which is evidence that clients don't use the `return_type` field,
thus renaming Dictionary => Dict in api_info() is not (in practice)
a breaking change.
Diffstat (limited to 'src/nvim/ui_client.c')
-rw-r--r-- | src/nvim/ui_client.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/nvim/ui_client.c b/src/nvim/ui_client.c index 43ab238716..adaf3eadb8 100644 --- a/src/nvim/ui_client.c +++ b/src/nvim/ui_client.c @@ -107,7 +107,7 @@ void ui_client_attach(int width, int height, char *term, bool rgb) ui_client_forward_stdin = false; // stdin shouldn't be forwarded again #22292 } } - ADD_C(args, DICTIONARY_OBJ(opts)); + ADD_C(args, DICT_OBJ(opts)); rpc_send_event(ui_client_channel_id, "nvim_ui_attach", args); ui_client_attached = true; @@ -120,17 +120,17 @@ void ui_client_attach(int width, int height, char *term, bool rgb) MAXSIZE_TEMP_ARRAY(args2, 5); ADD_C(args2, CSTR_AS_OBJ("nvim-tui")); // name Object m = api_metadata(); - Dictionary version = { 0 }; - assert(m.data.dictionary.size > 0); - for (size_t i = 0; i < m.data.dictionary.size; i++) { - if (strequal(m.data.dictionary.items[i].key.data, "version")) { - version = m.data.dictionary.items[i].value.data.dictionary; + Dict version = { 0 }; + assert(m.data.dict.size > 0); + for (size_t i = 0; i < m.data.dict.size; i++) { + if (strequal(m.data.dict.items[i].key.data, "version")) { + version = m.data.dict.items[i].value.data.dict; break; - } else if (i + 1 == m.data.dictionary.size) { + } else if (i + 1 == m.data.dict.size) { abort(); } } - ADD_C(args2, DICTIONARY_OBJ(version)); // version + ADD_C(args2, DICT_OBJ(version)); // version ADD_C(args2, CSTR_AS_OBJ("ui")); // type // We don't send api_metadata.functions as the "methods" because: // 1. it consumes memory. @@ -141,7 +141,7 @@ void ui_client_attach(int width, int height, char *term, bool rgb) PUT_C(info, "website", CSTR_AS_OBJ("https://neovim.io")); PUT_C(info, "license", CSTR_AS_OBJ("Apache 2")); PUT_C(info, "pid", INTEGER_OBJ(os_get_pid())); - ADD_C(args2, DICTIONARY_OBJ(info)); // attributes + ADD_C(args2, DICT_OBJ(info)); // attributes rpc_send_event(ui_client_channel_id, "nvim_set_client_info", args2); TIME_MSG("nvim_set_client_info"); @@ -215,7 +215,7 @@ Object handle_ui_client_redraw(uint64_t channel_id, Array args, Arena *arena, Er return NIL; } -static HlAttrs ui_client_dict2hlattrs(Dictionary d, bool rgb) +static HlAttrs ui_client_dict2hlattrs(Dict d, bool rgb) { Error err = ERROR_INIT; Dict(highlight) dict = KEYDICT_INIT; |