[Top][All Lists]

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

[elpa] externals/eglot 0cde01f 05/12: Close #26: Guess server for js2-mo

From: João Távora
Subject: [elpa] externals/eglot 0cde01f 05/12: Close #26: Guess server for js2-mode and rjsx-mode
Date: Fri, 22 Jun 2018 11:52:16 -0400 (EDT)

branch: externals/eglot
commit 0cde01f984b4278b1a964a79a98f2758afd10e7c
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    Close #26: Guess server for js2-mode and rjsx-mode
    * eglot.el (eglot-server-programs): Add entries for js2-mode and
    rjsx-mode.  Coalesce entries for c++ and c-mode.  Improve
    (eglot--guess-contact): Allow lists are keys in
 eglot.el | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/eglot.el b/eglot.el
index ecbd509..447e8c1 100644
--- a/eglot.el
+++ b/eglot.el
@@ -78,15 +78,19 @@
 (defvar eglot-server-programs '((rust-mode . (eglot-rls "rls"))
                                 (python-mode . ("pyls"))
-                                (js-mode . ("javascript-typescript-stdio"))
+                                ((js-mode
+                                  js2-mode
+                                  rjsx-mode) . ("javascript-typescript-stdio"))
                                 (sh-mode . ("bash-language-server" "start"))
-                                (c++-mode . (eglot-cquery "cquery"))
-                                (c-mode . (eglot-cquery "cquery"))
+                                ((c++-mode
+                                  c-mode) . (eglot-cquery "cquery"))
                                 (php-mode . ("php" "vendor/felixfbecker/\
   "How the command `eglot' guesses the server to start.
 An association list of (MAJOR-MODE . SPEC) pair.  MAJOR-MODE is a
-mode symbol.  SPEC is
+mode symbol, or a list of mode symbols.  The associated SPEC
+specifies how to start a server for managing buffers of those
+modes.  SPEC can be:
 * In the most common case, a list of strings (PROGRAM [ARGS...]).
 PROGRAM is called with ARGS and is expected to serve LSP requests
@@ -359,7 +363,10 @@ be guessed."
             (eglot--error "Can't guess mode to manage for `%s'" 
            (t guessed-mode)))
          (project (or (project-current) `(transient . ,default-directory)))
-         (guess (cdr (assoc managed-mode eglot-server-programs)))
+         (guess (cdr (assoc managed-mode eglot-server-programs
+                            (lambda (m1 m2)
+                              (or (eq m1 m2)
+                                  (and (listp m1) (memq m2 m1)))))))
          (class (or (and (consp guess) (symbolp (car guess))
                          (prog1 (car guess) (setq guess (cdr guess))))

reply via email to

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