Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(NvimClient.API): add docstrings for public API #15

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
/// Interface to the Neovim msgpack-rpc API.
/// </summary>
smolck marked this conversation as resolved.
Show resolved Hide resolved
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
Loading