diff --git a/src/NvimClient.API/NvimAPI.cs b/src/NvimClient.API/NvimAPI.cs index a3c34de..20c132d 100644 --- a/src/NvimClient.API/NvimAPI.cs +++ b/src/NvimClient.API/NvimAPI.cs @@ -19,9 +19,19 @@ namespace NvimClient.API { + /// + /// Interface to the Neovim msgpack-rpc API. + /// public partial class NvimAPI { + /// + /// Handler for requests from Neovim without a handler registered via + /// public event EventHandler OnUnhandledRequest; + + /// + /// Handler for notifications from Neovim without a handler registered via + /// public event EventHandler OnUnhandledNotification; @@ -130,12 +140,27 @@ public NvimAPI(Stream inputStream, Stream outputStream) StartReceiveLoop(); } + /// + /// Register a handler for the name notification or request. + /// + /// + /// public void RegisterHandler(string name, Func handler) => RegisterHandler(name, (Delegate)handler); + /// + /// Register a handler for the name notification or request. + /// + /// + /// public void RegisterHandler(string name, Action handler) => RegisterHandler(name, (Delegate)handler); + /// + /// Register a handler for the name notification or request. + /// + /// + /// public void RegisterHandler(string name, Func> handler) => RegisterHandler(name, (requestId, args) => @@ -337,6 +362,9 @@ async void Receive() } } + /// + /// Block the current thread while waiting for Neovim to quit. + /// public void WaitForDisconnect() => _waitEvent.WaitOne(); private class PendingRequest diff --git a/src/NvimClient.API/NvimAPI.generated.cs b/src/NvimClient.API/NvimAPI.generated.cs index dfae524..660acf1 100644 --- a/src/NvimClient.API/NvimAPI.generated.cs +++ b/src/NvimClient.API/NvimAPI.generated.cs @@ -11,67 +11,1106 @@ namespace NvimClient.API { public partial class NvimAPI { + + /// + /// EventHandler for mode_info_set UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.ModeInfoSetEvent += (sender, args) => + /// { + /// // `args` is of type `ModeInfoSetEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler ModeInfoSetEvent; + + /// + /// EventHandler for update_menu UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.UpdateMenuEvent += (sender, args) => + /// { + /// // `args` contains no data for this event. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// public event EventHandler UpdateMenuEvent; + + /// + /// EventHandler for busy_start UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.BusyStartEvent += (sender, args) => + /// { + /// // `args` contains no data for this event. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// public event EventHandler BusyStartEvent; + + /// + /// EventHandler for busy_stop UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.BusyStopEvent += (sender, args) => + /// { + /// // `args` contains no data for this event. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// public event EventHandler BusyStopEvent; + + /// + /// EventHandler for mouse_on UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.MouseOnEvent += (sender, args) => + /// { + /// // `args` contains no data for this event. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// public event EventHandler MouseOnEvent; + + /// + /// EventHandler for mouse_off UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.MouseOffEvent += (sender, args) => + /// { + /// // `args` contains no data for this event. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// public event EventHandler MouseOffEvent; + + /// + /// EventHandler for mode_change UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.ModeChangeEvent += (sender, args) => + /// { + /// // `args` is of type `ModeChangeEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler ModeChangeEvent; + + /// + /// EventHandler for bell UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.BellEvent += (sender, args) => + /// { + /// // `args` contains no data for this event. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// public event EventHandler BellEvent; + + /// + /// EventHandler for visual_bell UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.VisualBellEvent += (sender, args) => + /// { + /// // `args` contains no data for this event. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// public event EventHandler VisualBellEvent; + + /// + /// EventHandler for flush UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.FlushEvent += (sender, args) => + /// { + /// // `args` contains no data for this event. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// public event EventHandler FlushEvent; + + /// + /// EventHandler for suspend UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.SuspendEvent += (sender, args) => + /// { + /// // `args` contains no data for this event. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// public event EventHandler SuspendEvent; + + /// + /// EventHandler for set_title UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.SetTitleEvent += (sender, args) => + /// { + /// // `args` is of type `SetTitleEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler SetTitleEvent; + + /// + /// EventHandler for set_icon UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.SetIconEvent += (sender, args) => + /// { + /// // `args` is of type `SetIconEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler SetIconEvent; + + /// + /// EventHandler for screenshot UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.ScreenshotEvent += (sender, args) => + /// { + /// // `args` is of type `ScreenshotEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler ScreenshotEvent; + + /// + /// EventHandler for option_set UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.OptionSetEvent += (sender, args) => + /// { + /// // `args` is of type `OptionSetEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler OptionSetEvent; + + /// + /// EventHandler for update_fg UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.UpdateFgEvent += (sender, args) => + /// { + /// // `args` is of type `UpdateFgEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler UpdateFgEvent; + + /// + /// EventHandler for update_bg UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.UpdateBgEvent += (sender, args) => + /// { + /// // `args` is of type `UpdateBgEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler UpdateBgEvent; + + /// + /// EventHandler for update_sp UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.UpdateSpEvent += (sender, args) => + /// { + /// // `args` is of type `UpdateSpEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler UpdateSpEvent; + + /// + /// EventHandler for resize UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.ResizeEvent += (sender, args) => + /// { + /// // `args` is of type `ResizeEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler ResizeEvent; + + /// + /// EventHandler for clear UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.ClearEvent += (sender, args) => + /// { + /// // `args` contains no data for this event. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// public event EventHandler ClearEvent; + + /// + /// EventHandler for eol_clear UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.EolClearEvent += (sender, args) => + /// { + /// // `args` contains no data for this event. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// public event EventHandler EolClearEvent; + + /// + /// EventHandler for cursor_goto UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.CursorGotoEvent += (sender, args) => + /// { + /// // `args` is of type `CursorGotoEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler CursorGotoEvent; + + /// + /// EventHandler for highlight_set UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.HighlightSetEvent += (sender, args) => + /// { + /// // `args` is of type `HighlightSetEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler HighlightSetEvent; + + /// + /// EventHandler for put UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.PutEvent += (sender, args) => + /// { + /// // `args` is of type `PutEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler PutEvent; + + /// + /// EventHandler for set_scroll_region UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.SetScrollRegionEvent += (sender, args) => + /// { + /// // `args` is of type `SetScrollRegionEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler SetScrollRegionEvent; + + /// + /// EventHandler for scroll UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.ScrollEvent += (sender, args) => + /// { + /// // `args` is of type `ScrollEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler ScrollEvent; + + /// + /// EventHandler for default_colors_set UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.DefaultColorsSetEvent += (sender, args) => + /// { + /// // `args` is of type `DefaultColorsSetEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler DefaultColorsSetEvent; + + /// + /// EventHandler for hl_attr_define UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.HlAttrDefineEvent += (sender, args) => + /// { + /// // `args` is of type `HlAttrDefineEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler HlAttrDefineEvent; + + /// + /// EventHandler for hl_group_set UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.HlGroupSetEvent += (sender, args) => + /// { + /// // `args` is of type `HlGroupSetEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler HlGroupSetEvent; + + /// + /// EventHandler for grid_resize UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.GridResizeEvent += (sender, args) => + /// { + /// // `args` is of type `GridResizeEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler GridResizeEvent; + + /// + /// EventHandler for grid_clear UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.GridClearEvent += (sender, args) => + /// { + /// // `args` is of type `GridClearEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler GridClearEvent; + + /// + /// EventHandler for grid_cursor_goto UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.GridCursorGotoEvent += (sender, args) => + /// { + /// // `args` is of type `GridCursorGotoEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler GridCursorGotoEvent; + + /// + /// EventHandler for grid_line UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.GridLineEvent += (sender, args) => + /// { + /// // `args` is of type `GridLineEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler GridLineEvent; + + /// + /// EventHandler for grid_scroll UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.GridScrollEvent += (sender, args) => + /// { + /// // `args` is of type `GridScrollEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler GridScrollEvent; + + /// + /// EventHandler for grid_destroy UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.GridDestroyEvent += (sender, args) => + /// { + /// // `args` is of type `GridDestroyEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler GridDestroyEvent; + + /// + /// EventHandler for win_pos UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.WinPosEvent += (sender, args) => + /// { + /// // `args` is of type `WinPosEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler WinPosEvent; + + /// + /// EventHandler for win_float_pos UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.WinFloatPosEvent += (sender, args) => + /// { + /// // `args` is of type `WinFloatPosEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler WinFloatPosEvent; + + /// + /// EventHandler for win_external_pos UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.WinExternalPosEvent += (sender, args) => + /// { + /// // `args` is of type `WinExternalPosEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler WinExternalPosEvent; + + /// + /// EventHandler for win_hide UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.WinHideEvent += (sender, args) => + /// { + /// // `args` is of type `WinHideEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler WinHideEvent; + + /// + /// EventHandler for win_close UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.WinCloseEvent += (sender, args) => + /// { + /// // `args` is of type `WinCloseEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler WinCloseEvent; + + /// + /// EventHandler for msg_set_pos UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.MsgSetPosEvent += (sender, args) => + /// { + /// // `args` is of type `MsgSetPosEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler MsgSetPosEvent; + + /// + /// EventHandler for win_viewport UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.WinViewportEvent += (sender, args) => + /// { + /// // `args` is of type `WinViewportEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler WinViewportEvent; + + /// + /// EventHandler for popupmenu_show UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.PopupmenuShowEvent += (sender, args) => + /// { + /// // `args` is of type `PopupmenuShowEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler PopupmenuShowEvent; + + /// + /// EventHandler for popupmenu_hide UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.PopupmenuHideEvent += (sender, args) => + /// { + /// // `args` contains no data for this event. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// public event EventHandler PopupmenuHideEvent; + + /// + /// EventHandler for popupmenu_select UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.PopupmenuSelectEvent += (sender, args) => + /// { + /// // `args` is of type `PopupmenuSelectEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler PopupmenuSelectEvent; + + /// + /// EventHandler for tabline_update UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.TablineUpdateEvent += (sender, args) => + /// { + /// // `args` is of type `TablineUpdateEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler TablineUpdateEvent; + + /// + /// EventHandler for cmdline_show UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.CmdlineShowEvent += (sender, args) => + /// { + /// // `args` is of type `CmdlineShowEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler CmdlineShowEvent; + + /// + /// EventHandler for cmdline_pos UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.CmdlinePosEvent += (sender, args) => + /// { + /// // `args` is of type `CmdlinePosEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler CmdlinePosEvent; + + /// + /// EventHandler for cmdline_special_char UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.CmdlineSpecialCharEvent += (sender, args) => + /// { + /// // `args` is of type `CmdlineSpecialCharEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler CmdlineSpecialCharEvent; + + /// + /// EventHandler for cmdline_hide UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.CmdlineHideEvent += (sender, args) => + /// { + /// // `args` is of type `CmdlineHideEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler CmdlineHideEvent; + + /// + /// EventHandler for cmdline_block_show UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.CmdlineBlockShowEvent += (sender, args) => + /// { + /// // `args` is of type `CmdlineBlockShowEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler CmdlineBlockShowEvent; + + /// + /// EventHandler for cmdline_block_append UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.CmdlineBlockAppendEvent += (sender, args) => + /// { + /// // `args` is of type `CmdlineBlockAppendEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler CmdlineBlockAppendEvent; + + /// + /// EventHandler for cmdline_block_hide UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.CmdlineBlockHideEvent += (sender, args) => + /// { + /// // `args` contains no data for this event. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// public event EventHandler CmdlineBlockHideEvent; + + /// + /// EventHandler for wildmenu_show UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.WildmenuShowEvent += (sender, args) => + /// { + /// // `args` is of type `WildmenuShowEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler WildmenuShowEvent; + + /// + /// EventHandler for wildmenu_select UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.WildmenuSelectEvent += (sender, args) => + /// { + /// // `args` is of type `WildmenuSelectEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler WildmenuSelectEvent; + + /// + /// EventHandler for wildmenu_hide UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.WildmenuHideEvent += (sender, args) => + /// { + /// // `args` contains no data for this event. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// public event EventHandler WildmenuHideEvent; + + /// + /// EventHandler for msg_show UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.MsgShowEvent += (sender, args) => + /// { + /// // `args` is of type `MsgShowEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler MsgShowEvent; + + /// + /// EventHandler for msg_clear UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.MsgClearEvent += (sender, args) => + /// { + /// // `args` contains no data for this event. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// public event EventHandler MsgClearEvent; + + /// + /// EventHandler for msg_showcmd UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.MsgShowcmdEvent += (sender, args) => + /// { + /// // `args` is of type `MsgShowcmdEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler MsgShowcmdEvent; + + /// + /// EventHandler for msg_showmode UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.MsgShowmodeEvent += (sender, args) => + /// { + /// // `args` is of type `MsgShowmodeEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler MsgShowmodeEvent; + + /// + /// EventHandler for msg_ruler UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.MsgRulerEvent += (sender, args) => + /// { + /// // `args` is of type `MsgRulerEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler MsgRulerEvent; + + /// + /// EventHandler for msg_history_show UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.MsgHistoryShowEvent += (sender, args) => + /// { + /// // `args` is of type `MsgHistoryShowEventArgs`. + /// // Handler code goes here. + /// } + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// + /// public event EventHandler MsgHistoryShowEvent; /// diff --git a/src/NvimClient.APIGenerator/NvimAPIGenerator.cs b/src/NvimClient.APIGenerator/NvimAPIGenerator.cs index 44166e9..11ad4f2 100644 --- a/src/NvimClient.APIGenerator/NvimAPIGenerator.cs +++ b/src/NvimClient.APIGenerator/NvimAPIGenerator.cs @@ -123,11 +123,27 @@ private static string GenerateNvimUIEvents( string.Join("\n", uiEvents.Select(uiEvent => { - var camelCaseName = StringUtil.ConvertToCamelCase(uiEvent.Name, true); + var camelCaseName = $"{StringUtil.ConvertToCamelCase(uiEvent.Name, true)}Event"; var genericTypeParam = uiEvent.Parameters.Any() - ? $"<{camelCaseName}EventArgs>" + ? $"<{camelCaseName}Args>" : string.Empty; - return $" public event EventHandler{genericTypeParam} {camelCaseName}Event;"; + return $@" + /// + /// EventHandler for {uiEvent.Name} UI event (see corresponding + /// docs in `:help ui-events` in nvim). + /// + /// + /// + /// var api = new NvimAPI(); + /// api.{camelCaseName} += (sender, args) => + /// {{ + /// // `args` {(genericTypeParam == string.Empty ? "contains no data for this event." : $"is of type `{camelCaseName}Args`.")} + /// // Handler code goes here. + /// }} + /// // This handler will be executed whenever the event is emitted after attaching the UI. + /// + /// {(genericTypeParam == string.Empty ? "" : $"\n /// ")} + public event EventHandler{genericTypeParam} {camelCaseName};"; })); private static string GenerateNvimUIEventArgs(