aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-04-08 10:38:30 +0200
committerGitHub <noreply@github.com>2023-04-08 10:38:30 +0200
commit72d5a13e55e94bdebfffab5f656f553bb76c7b10 (patch)
tree1d715a4a8fd80371775c46a5b82767c8a78580ed /src/nvim/api
parentbc66b755f61ba0e3383177b2866e05557ffa3966 (diff)
parentefb0896f21e03f64e3a14e7c09994e81956f47b9 (diff)
downloadrneovim-72d5a13e55e94bdebfffab5f656f553bb76c7b10.tar.gz
rneovim-72d5a13e55e94bdebfffab5f656f553bb76c7b10.tar.bz2
rneovim-72d5a13e55e94bdebfffab5f656f553bb76c7b10.zip
Merge pull request #22873 from bfredl/keyset2
refactor(api): make typed dicts appear as real types in the source code
Diffstat (limited to 'src/nvim/api')
-rw-r--r--src/nvim/api/autocmd.h1
-rw-r--r--src/nvim/api/buffer.h1
-rw-r--r--src/nvim/api/command.c1
-rw-r--r--src/nvim/api/command.h1
-rw-r--r--src/nvim/api/extmark.h1
-rw-r--r--src/nvim/api/keysets.h270
-rw-r--r--src/nvim/api/keysets.lua239
-rw-r--r--src/nvim/api/options.h2
-rw-r--r--src/nvim/api/private/defs.h4
-rw-r--r--src/nvim/api/private/dispatch.h1
-rw-r--r--src/nvim/api/private/helpers.h1
-rw-r--r--src/nvim/api/vim.h1
-rw-r--r--src/nvim/api/vimscript.h1
-rw-r--r--src/nvim/api/win_config.h1
14 files changed, 281 insertions, 244 deletions
diff --git a/src/nvim/api/autocmd.h b/src/nvim/api/autocmd.h
index f9432830d9..3273ca5759 100644
--- a/src/nvim/api/autocmd.h
+++ b/src/nvim/api/autocmd.h
@@ -3,6 +3,7 @@
#include <stdint.h>
+#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/api/buffer.h b/src/nvim/api/buffer.h
index 0814da63cd..db58239af8 100644
--- a/src/nvim/api/buffer.h
+++ b/src/nvim/api/buffer.h
@@ -3,6 +3,7 @@
#include <lauxlib.h>
+#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
#include "nvim/buffer_defs.h"
diff --git a/src/nvim/api/command.c b/src/nvim/api/command.c
index 7c01dc0e54..3df80e3fed 100644
--- a/src/nvim/api/command.c
+++ b/src/nvim/api/command.c
@@ -10,6 +10,7 @@
#include "lauxlib.h"
#include "nvim/api/command.h"
#include "nvim/api/private/defs.h"
+#include "nvim/api/private/dispatch.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/private/validate.h"
#include "nvim/ascii.h"
diff --git a/src/nvim/api/command.h b/src/nvim/api/command.h
index b1c9230551..f16bd0acde 100644
--- a/src/nvim/api/command.h
+++ b/src/nvim/api/command.h
@@ -1,6 +1,7 @@
#ifndef NVIM_API_COMMAND_H
#define NVIM_API_COMMAND_H
+#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
#include "nvim/decoration.h"
#include "nvim/ex_cmds.h"
diff --git a/src/nvim/api/extmark.h b/src/nvim/api/extmark.h
index 0a627a889c..a6586e3031 100644
--- a/src/nvim/api/extmark.h
+++ b/src/nvim/api/extmark.h
@@ -1,6 +1,7 @@
#ifndef NVIM_API_EXTMARK_H
#define NVIM_API_EXTMARK_H
+#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
#include "nvim/decoration.h"
#include "nvim/macros.h"
diff --git a/src/nvim/api/keysets.h b/src/nvim/api/keysets.h
new file mode 100644
index 0000000000..333b90d7fd
--- /dev/null
+++ b/src/nvim/api/keysets.h
@@ -0,0 +1,270 @@
+#ifndef NVIM_API_KEYSETS_H
+#define NVIM_API_KEYSETS_H
+
+#include "nvim/api/private/defs.h"
+
+typedef struct {
+ Object types;
+} Dict(context);
+
+typedef struct {
+ Object on_start;
+ Object on_buf;
+ Object on_win;
+ Object on_line;
+ Object on_end;
+ Object _on_hl_def;
+ Object _on_spell_nav;
+} Dict(set_decoration_provider);
+
+typedef struct {
+ Object id;
+ Object end_line;
+ Object end_row;
+ Object end_col;
+ Object hl_group;
+ Object virt_text;
+ Object virt_text_pos;
+ Object virt_text_win_col;
+ Object virt_text_hide;
+ Object hl_eol;
+ Object hl_mode;
+ Object ephemeral;
+ Object priority;
+ Object right_gravity;
+ Object end_right_gravity;
+ Object virt_lines;
+ Object virt_lines_above;
+ Object virt_lines_leftcol;
+ Object strict;
+ Object sign_text;
+ Object sign_hl_group;
+ Object number_hl_group;
+ Object line_hl_group;
+ Object cursorline_hl_group;
+ Object conceal;
+ Object spell;
+ Object ui_watched;
+} Dict(set_extmark);
+
+typedef struct {
+ Object noremap;
+ Object nowait;
+ Object silent;
+ Object script;
+ Object expr;
+ Object unique;
+ Object callback;
+ Object desc;
+ Object replace_keycodes;
+} Dict(keymap);
+
+typedef struct {
+ Object builtin;
+} Dict(get_commands);
+
+typedef struct {
+ Object addr;
+ Object bang;
+ Object bar;
+ Object complete;
+ Object count;
+ Object desc;
+ Object force;
+ Object keepscript;
+ Object nargs;
+ Object preview;
+ Object range;
+ Object register_;
+} Dict(user_command);
+
+typedef struct {
+ Object row;
+ Object col;
+ Object width;
+ Object height;
+ Object anchor;
+ Object relative;
+ Object win;
+ Object bufpos;
+ Object external;
+ Object focusable;
+ Object zindex;
+ Object border;
+ Object title;
+ Object title_pos;
+ Object style;
+ Object noautocmd;
+} Dict(float_config);
+
+typedef struct {
+ Object is_lua;
+ Object do_source;
+} Dict(runtime);
+
+typedef struct {
+ Object winid;
+ Object maxwidth;
+ Object fillchar;
+ Object highlights;
+ Object use_winbar;
+ Object use_tabline;
+ Object use_statuscol_lnum;
+} Dict(eval_statusline);
+
+typedef struct {
+ Object scope;
+ Object win;
+ Object buf;
+ Object filetype;
+} Dict(option);
+
+typedef struct {
+ Object bold;
+ Object standout;
+ Object strikethrough;
+ Object underline;
+ Object undercurl;
+ Object underdouble;
+ Object underdotted;
+ Object underdashed;
+ Object italic;
+ Object reverse;
+ Object altfont;
+ Object nocombine;
+ Object default_;
+ Object cterm;
+ Object foreground;
+ Object fg;
+ Object background;
+ Object bg;
+ Object ctermfg;
+ Object ctermbg;
+ Object special;
+ Object sp;
+ Object link;
+ Object global_link;
+ Object fallback;
+ Object blend;
+ Object fg_indexed;
+ Object bg_indexed;
+} Dict(highlight);
+
+typedef struct {
+ Object bold;
+ Object standout;
+ Object strikethrough;
+ Object underline;
+ Object undercurl;
+ Object underdouble;
+ Object underdotted;
+ Object underdashed;
+ Object italic;
+ Object reverse;
+ Object altfont;
+ Object nocombine;
+} Dict(highlight_cterm);
+
+typedef struct {
+ Object id;
+ Object name;
+ Object link;
+} Dict(get_highlight);
+
+typedef struct {
+ Object buffer;
+ Object event;
+ Object group;
+ Object pattern;
+} Dict(clear_autocmds);
+
+typedef struct {
+ Object buffer;
+ Object callback;
+ Object command;
+ Object desc;
+ Object group;
+ Object nested;
+ Object once;
+ Object pattern;
+} Dict(create_autocmd);
+
+typedef struct {
+ Object buffer;
+ Object group;
+ Object modeline;
+ Object pattern;
+ Object data;
+} Dict(exec_autocmds);
+
+typedef struct {
+ Object event;
+ Object group;
+ Object pattern;
+ Object buffer;
+} Dict(get_autocmds);
+
+typedef struct {
+ Object clear;
+} Dict(create_augroup);
+
+typedef struct {
+ Object cmd;
+ Object range;
+ Object count;
+ Object reg;
+ Object bang;
+ Object args;
+ Object magic;
+ Object mods;
+ Object nargs;
+ Object addr;
+ Object nextcmd;
+} Dict(cmd);
+
+typedef struct {
+ Object file;
+ Object bar;
+} Dict(cmd_magic);
+
+typedef struct {
+ Object silent;
+ Object emsg_silent;
+ Object unsilent;
+ Object filter;
+ Object sandbox;
+ Object noautocmd;
+ Object browse;
+ Object confirm;
+ Object hide;
+ Object horizontal;
+ Object keepalt;
+ Object keepjumps;
+ Object keepmarks;
+ Object keeppatterns;
+ Object lockmarks;
+ Object noswapfile;
+ Object tab;
+ Object verbose;
+ Object vertical;
+ Object split;
+} Dict(cmd_mods);
+
+typedef struct {
+ Object pattern;
+ Object force;
+} Dict(cmd_mods_filter);
+
+typedef struct {
+ Object output;
+} Dict(cmd_opts);
+
+typedef struct {
+ Object verbose;
+} Dict(echo_opts);
+
+typedef struct {
+ Object output;
+} Dict(exec_opts);
+
+#endif // NVIM_API_KEYSETS_H
diff --git a/src/nvim/api/keysets.lua b/src/nvim/api/keysets.lua
deleted file mode 100644
index 01f5a8b860..0000000000
--- a/src/nvim/api/keysets.lua
+++ /dev/null
@@ -1,239 +0,0 @@
-return {
- { 'context', {
- "types";
- }};
- { 'set_decoration_provider', {
- "on_start";
- "on_buf";
- "on_win";
- "on_line";
- "on_end";
- "_on_hl_def";
- "_on_spell_nav";
- }};
- { 'set_extmark', {
- "id";
- "end_line";
- "end_row";
- "end_col";
- "hl_group";
- "virt_text";
- "virt_text_pos";
- "virt_text_win_col";
- "virt_text_hide";
- "hl_eol";
- "hl_mode";
- "ephemeral";
- "priority";
- "right_gravity";
- "end_right_gravity";
- "virt_lines";
- "virt_lines_above";
- "virt_lines_leftcol";
- "strict";
- "sign_text";
- "sign_hl_group";
- "number_hl_group";
- "line_hl_group";
- "cursorline_hl_group";
- "conceal";
- "spell";
- "ui_watched";
- }};
- { 'keymap', {
- "noremap";
- "nowait";
- "silent";
- "script";
- "expr";
- "unique";
- "callback";
- "desc";
- "replace_keycodes";
- }};
- { 'get_commands', {
- "builtin";
- }};
- { 'user_command', {
- "addr";
- "bang";
- "bar";
- "complete";
- "count";
- "desc";
- "force";
- "keepscript";
- "nargs";
- "preview";
- "range";
- "register";
- }};
- { 'float_config', {
- "row";
- "col";
- "width";
- "height";
- "anchor";
- "relative";
- "win";
- "bufpos";
- "external";
- "focusable";
- "zindex";
- "border";
- "title";
- "title_pos";
- "style";
- "noautocmd";
- }};
- { 'runtime', {
- "is_lua";
- "do_source";
- }};
- { 'eval_statusline', {
- "winid";
- "maxwidth";
- "fillchar";
- "highlights";
- "use_winbar";
- "use_tabline";
- "use_statuscol_lnum";
- }};
- { 'option', {
- "scope";
- "win";
- "buf";
- "filetype";
- }};
- { 'highlight', {
- "bold";
- "standout";
- "strikethrough";
- "underline";
- "undercurl";
- "underdouble";
- "underdotted";
- "underdashed";
- "italic";
- "reverse";
- "altfont";
- "nocombine";
- "default";
- "cterm";
- "foreground"; "fg";
- "background"; "bg";
- "ctermfg";
- "ctermbg";
- "special"; "sp";
- "link";
- "global_link";
- "fallback";
- "blend";
- "fg_indexed";
- "bg_indexed";
- }};
- { 'highlight_cterm', {
- "bold";
- "standout";
- "strikethrough";
- "underline";
- "undercurl";
- "underdouble";
- "underdotted";
- "underdashed";
- "italic";
- "reverse";
- "altfont";
- "nocombine";
- }};
- { 'get_highlight', {
- "id";
- "name";
- "link";
- }};
- -- Autocmds
- { 'clear_autocmds', {
- "buffer";
- "event";
- "group";
- "pattern";
- }};
- { 'create_autocmd', {
- "buffer";
- "callback";
- "command";
- "desc";
- "group";
- "nested";
- "once";
- "pattern";
- }};
- { 'exec_autocmds', {
- "buffer";
- "group";
- "modeline";
- "pattern";
- "data";
- }};
- { 'get_autocmds', {
- "event";
- "group";
- "pattern";
- "buffer";
- }};
- { 'create_augroup', {
- "clear";
- }};
- { 'cmd', {
- "cmd";
- "range";
- "count";
- "reg";
- "bang";
- "args";
- "magic";
- "mods";
- "nargs";
- "addr";
- "nextcmd";
- }};
- { 'cmd_magic', {
- "file";
- "bar";
- }};
- { 'cmd_mods', {
- "silent";
- "emsg_silent";
- "unsilent";
- "filter";
- "sandbox";
- "noautocmd";
- "browse";
- "confirm";
- "hide";
- "horizontal";
- "keepalt";
- "keepjumps";
- "keepmarks";
- "keeppatterns";
- "lockmarks";
- "noswapfile";
- "tab";
- "verbose";
- "vertical";
- "split";
- }};
- { 'cmd_mods_filter', {
- "pattern";
- "force";
- }};
- { 'cmd_opts', {
- "output";
- }};
- { 'echo_opts', {
- "verbose";
- }};
- { 'exec_opts', {
- "output";
- }};
-}
diff --git a/src/nvim/api/options.h b/src/nvim/api/options.h
index efbfec3a6c..869826e443 100644
--- a/src/nvim/api/options.h
+++ b/src/nvim/api/options.h
@@ -1,7 +1,9 @@
#ifndef NVIM_API_OPTIONS_H
#define NVIM_API_OPTIONS_H
+#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/options.h.generated.h"
#endif
diff --git a/src/nvim/api/private/defs.h b/src/nvim/api/private/defs.h
index 8acbf0d9de..7c5559f096 100644
--- a/src/nvim/api/private/defs.h
+++ b/src/nvim/api/private/defs.h
@@ -130,8 +130,4 @@ typedef struct {
size_t ptr_off;
} KeySetLink;
-#ifdef INCLUDE_GENERATED_DECLARATIONS
-# include "keysets_defs.generated.h"
-#endif
-
#endif // NVIM_API_PRIVATE_DEFS_H
diff --git a/src/nvim/api/private/dispatch.h b/src/nvim/api/private/dispatch.h
index 4ae61b2bfb..78fcf88d7b 100644
--- a/src/nvim/api/private/dispatch.h
+++ b/src/nvim/api/private/dispatch.h
@@ -28,6 +28,7 @@ extern const MsgpackRpcRequestHandler method_handlers[];
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/private/dispatch.h.generated.h"
# include "api/private/dispatch_wrappers.h.generated.h"
+# include "keysets_defs.generated.h"
#endif
#endif // NVIM_API_PRIVATE_DISPATCH_H
diff --git a/src/nvim/api/private/helpers.h b/src/nvim/api/private/helpers.h
index eef97cccb2..2623c97c9d 100644
--- a/src/nvim/api/private/helpers.h
+++ b/src/nvim/api/private/helpers.h
@@ -181,7 +181,6 @@ typedef struct {
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/private/helpers.h.generated.h"
-# include "keysets.h.generated.h"
#endif
#define WITH_SCRIPT_CONTEXT(channel_id, code) \
diff --git a/src/nvim/api/vim.h b/src/nvim/api/vim.h
index de56c67665..c305749ba0 100644
--- a/src/nvim/api/vim.h
+++ b/src/nvim/api/vim.h
@@ -1,6 +1,7 @@
#ifndef NVIM_API_VIM_H
#define NVIM_API_VIM_H
+#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/api/vimscript.h b/src/nvim/api/vimscript.h
index be808b6b25..99ef43454b 100644
--- a/src/nvim/api/vimscript.h
+++ b/src/nvim/api/vimscript.h
@@ -1,6 +1,7 @@
#ifndef NVIM_API_VIMSCRIPT_H
#define NVIM_API_VIMSCRIPT_H
+#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/api/win_config.h b/src/nvim/api/win_config.h
index d3e5ede5e9..a4614f02ce 100644
--- a/src/nvim/api/win_config.h
+++ b/src/nvim/api/win_config.h
@@ -1,6 +1,7 @@
#ifndef NVIM_API_WIN_CONFIG_H
#define NVIM_API_WIN_CONFIG_H
+#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS