emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/eglot 05c68c2 45/69: Don't send dummy JSON object in "i


From: João Távora
Subject: [elpa] externals/eglot 05c68c2 45/69: Don't send dummy JSON object in "initialized" notification (#312)
Date: Sun, 20 Oct 2019 08:21:50 -0400 (EDT)

branch: externals/eglot
commit 05c68c252986cd4c400c313ab38664300e6b93a6
Author: Vladimir Panteleev <address@hidden>
Commit: João Távora <address@hidden>

    Don't send dummy JSON object in "initialized" notification (#312)
    
    Eglot uses a JSON object { __dummy__ : true } as a placeholder instead
    of the empty object {}.  It does this out of necessity, since encoding
    an empty object can't currently be easily using the current jsonrpc.el
    library.  However, this also causes the parameter to be actually sent
    to the server.
    
    Since the JSON-RPC specification states "The names MUST match exactly,
    including case, to the method's expected parameters" this is
    non-conforming to the protocol.
    
    The LSP specification does not seem to indicate how servers should
    handle method calls with parameters they do not support.  As such,
    ignoring the parameter, or reporting an error, or crashing all seem to
    be "valid" behaviors as far as the specification is concerned.
    
    We can avoid this by using an empty hash table instead of a dummy
    parameter.  Currently, an empty hash table is the only Emacs Lisp
    object which jsonrpc.el serializes to an empty JSON object in
    jsonrpc--json-encode.
    
    * eglot.el (eglot--connect): Use make-hash-table instead of dummy
      object.
    
    Copyright-paperwork-exempt: yes
---
 eglot.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eglot.el b/eglot.el
index cf2f371..ef7f8f0 100644
--- a/eglot.el
+++ b/eglot.el
@@ -848,7 +848,7 @@ This docstring appeases checkdoc, that's all."
                           (push server
                                 (gethash project eglot--servers-by-project))
                           (setf (eglot--capabilities server) capabilities)
-                          (jsonrpc-notify server :initialized `(:__dummy__ t))
+                          (jsonrpc-notify server :initialized 
(make-hash-table))
                           (dolist (buffer (buffer-list))
                             (with-current-buffer buffer
                               (eglot--maybe-activate-editing-mode server)))



reply via email to

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