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.
This commit is contained in:
Justin M. Keyes
2024-09-20 07:34:50 +02:00
parent 5acdc4499e
commit 737f58e232
77 changed files with 606 additions and 622 deletions

View File

@@ -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;