Skip to content

Commit

Permalink
docs(): add docstrings for NvimAPI.cs public members
Browse files Browse the repository at this point in the history
  • Loading branch information
smolck committed Sep 8, 2021
1 parent a66c3b2 commit ccbc026
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/NvimClient.API/NvimAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,19 @@

namespace NvimClient.API
{
/// <summary>
/// Class encapsulating the Neovim msgpack-rpc API in an idiomatic C# interface.
/// </summary>
public partial class NvimAPI
{
/// <summary>
/// Handler for requests from Neovim without a handler registered via <see cref="RegisterHandler"/>
/// </summary>
public event EventHandler<NvimUnhandledRequestEventArgs> OnUnhandledRequest;

/// <summary>
/// Handler for notifications from Neovim without a handler registered via <see cref="RegisterHandler"/>
/// </summary>
public event EventHandler<NvimUnhandledNotificationEventArgs>
OnUnhandledNotification;

Expand Down Expand Up @@ -130,12 +140,27 @@ public NvimAPI(Stream inputStream, Stream outputStream)
StartReceiveLoop();
}

/// <summary>
/// Register a handler for the <c>name</c> notification or request.
/// </summary>
/// <param name="name"></param>
/// <param name="handler"></param>
public void RegisterHandler(string name, Func<object[], object> handler) =>
RegisterHandler(name, (Delegate)handler);

/// <summary>
/// Register a handler for the <c>name</c> notification or request.
/// </summary>
/// <param name="name"></param>
/// <param name="handler"></param>
public void RegisterHandler(string name, Action<object[]> handler) =>
RegisterHandler(name, (Delegate)handler);

/// <summary>
/// Register a handler for the <c>name</c> notification or request.
/// </summary>
/// <param name="name"></param>
/// <param name="handler"></param>
public void RegisterHandler(string name,
Func<object[], Task<object>> handler) => RegisterHandler(name,
(requestId, args) =>
Expand Down Expand Up @@ -337,6 +362,9 @@ async void Receive()
}
}

/// <summary>
/// Block the current thread while waiting for Neovim to quit.
/// </summary>
public void WaitForDisconnect() => _waitEvent.WaitOne();

private class PendingRequest
Expand Down

0 comments on commit ccbc026

Please sign in to comment.