[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New jrpc.el JSONRPC library

From: João Távora
Subject: Re: New jrpc.el JSONRPC library
Date: Mon, 21 May 2018 00:22:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Josh Elsasser <address@hidden> writes:

> On May 20, 2018, at 12:13 PM, Clément Pit-Claudel <address@hidden> wrote:
>> On 2018-05-20 11:54, João Távora wrote:

> After working through the eglot.el source, it looks like the same
> thing could be managed by just defining a
> `eglot—server-myLangServer/customMethodName` handler. The API for
> sending/receive input from the server looks really clean, too -- the
> various custom extensions floating around out there could easily be
> implemented as langserver-specific packages with a depend on eglot.el

Thanks for the positive feedback, and indeed creating a clean API was a
design goal, but notice that:

  (cl-defun eglot--server-myLangServer/customMethodName
     (proc &key param1 param2)

has two dashes in it. It isn't (yet) a part of the official eglot.el LSP
API, and your particular example might very well become something like:

  (cl-defmethod eglot-handle-notification
     (proc (method (eql :myLangServer/customMethodName)) &key param1 param2)

or, for requests

  (cl-defmethod eglot-handle-request
     (proc id (method (eql :myLangServer/customMethodName)) &key param1 param2)

This seems cleaner than the "automagical" function names, although it
has two minor drawbacks:

1. M-x imenu won't let me search methods by their specializers

2. eldoc mode doesn't highlight :param1 and :param2 while writing a
   method call (but this isn't really a problem in this case because
   you're not going to be writing the function calls yourself).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]