]> git.eshelyaron.com Git - emacs.git/commitdiff
Eglot: send version in clientInfo (bug#62198)
authorFelicián Németh <felician.nemeth@gmail.com>
Sat, 15 Jul 2023 10:02:49 +0000 (12:02 +0200)
committerEli Zaretskii <eliz@gnu.org>
Thu, 3 Aug 2023 10:19:02 +0000 (13:19 +0300)
* lisp/progmodes/eglot.el (eglot--version): New defconst.
(eglot--connect): Use it.

lisp/progmodes/eglot.el

index ae31985a676c9fbc902a9aa713fa75ad7736d80c..37875e3d7f103710b19af2e073cf41c7dd25a3e1 100644 (file)
@@ -421,6 +421,14 @@ This can be useful when using docker to run a language server.")
 \f
 ;;; Constants
 ;;;
+(defconst eglot--version
+  (eval-when-compile
+    (when byte-compile-current-file
+      (require 'lisp-mnt)
+      (lm-version byte-compile-current-file)))
+  "The version as a string of this version of Eglot.
+It is nil if Eglot is not byte-complied.")
+
 (defconst eglot--symbol-kind-names
   `((1 . "File") (2 . "Module")
     (3 . "Namespace") (4 . "Package") (5 . "Class")
@@ -1352,7 +1360,9 @@ This docstring appeases checkdoc, that's all."
                                         (eq (jsonrpc-process-type server)
                                             'network))
                               (emacs-pid))
-                            :clientInfo '(:name "Eglot")
+                            :clientInfo
+                            `(:name "Eglot" ,@(when eglot--version
+                                                `(:version ,eglot--version)))
                             ;; Maybe turn trampy `/ssh:foo@bar:/path/to/baz.py'
                             ;; into `/path/to/baz.py', so LSP groks it.
                             :rootPath (file-local-name