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

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

[elpa] externals/eglot 32ba9d0 06/54: Expand README.md section on handli


From: João Távora
Subject: [elpa] externals/eglot 32ba9d0 06/54: Expand README.md section on handling quirky servers
Date: Thu, 16 Apr 2020 05:31:45 -0400 (EDT)

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

    Expand README.md section on handling quirky servers
    
    Also remove explicit cquery support (cquery seems to be dead anyway).
    
    * README.md (Handling quirky servers): New section.
    
    * eglot.el (eglot-initialization-options eglot-cquery): Remove.
---
 README.md | 37 +++++++++++++++++++++++++++----------
 eglot.el  | 13 -------------
 2 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/README.md b/README.md
index 06f8ff1..f0cbc1e 100644
--- a/README.md
+++ b/README.md
@@ -50,17 +50,9 @@ customize `eglot-server-programs`:
 (add-to-list 'eglot-server-programs '(foo-mode . ("foo-language-server" 
"--args")))
 ```
 
-Let me know how well it works and we can add it to the list.  If the
-server has some quirk or non-conformity, it's possible to extend Eglot
-to adapt to it.  Here's how to get [cquery][cquery] working for
-example:
+Let me know how well it works and we can add it to the list.  
 
-```lisp
-(add-to-list 'eglot-server-programs '((c++ mode c-mode) . (eglot-cquery 
"cquery")))
-```
-
-You can also enter a `server:port` pattern to connect to an LSP
-server. To skip the guess and always be prompted use `C-u M-x eglot`.
+To skip the guess and always be prompted use `C-u M-x eglot`.
 
 ## Connecting automatically
 
@@ -102,6 +94,31 @@ it be started as a server.  Notice the `:autoport` symbol 
in there: it
 is replaced dynamically by a local port believed to be vacant, so that
 the ensuing TCP connection finds a listening server.
 
+## Handling quirky servers
+
+Most servers can guess good defaults and will operate nicely
+out-of-the-box, but some need to be configured specially via LSP's
+interfaces.  If your server has some quirk or non-conformity, it's
+possible to extend Eglot to adapt to it.  Here's an example on how to
+get [cquery][cquery] working:
+
+```lisp
+(add-to-list 'eglot-server-programs '((c++ mode c-mode) . (eglot-cquery 
"cquery")))
+
+(defclass eglot-cquery (eglot-lsp-server) ()
+  :documentation "A custom class for cquery's C/C++ langserver.")
+
+(cl-defmethod eglot-initialization-options ((server eglot-cquery))
+  "Passes through required cquery initialization options"
+  (let* ((root (car (project-roots (eglot--project server))))
+         (cache (expand-file-name ".cquery_cached_index/" root)))
+    (list :cacheDirectory (file-name-as-directory cache)
+          :progressReportFrequencyMs -1)))
+```
+
+See `eglot.el`'s section on Java's JDT server for an even more
+sophisticated example.
+
 <a name="reporting bugs"></a>
 # Reporting bugs
 
diff --git a/eglot.el b/eglot.el
index 9a0960d..75ce937 100644
--- a/eglot.el
+++ b/eglot.el
@@ -2512,19 +2512,6 @@ If SKIP-SIGNATURE, don't try to send 
textDocument/signatureHelp."
   (setf (eglot--spinner server) (list id title done message)))
 
 
-;;; cquery-specific
-;;;
-(defclass eglot-cquery (eglot-lsp-server) ()
-  :documentation "Cquery's C/C++ langserver.")
-
-(cl-defmethod eglot-initialization-options ((server eglot-cquery))
-  "Passes through required cquery initialization options"
-  (let* ((root (car (project-roots (eglot--project server))))
-         (cache (expand-file-name ".cquery_cached_index/" root)))
-    (list :cacheDirectory (file-name-as-directory cache)
-          :progressReportFrequencyMs -1)))
-
-
 ;;; eclipse-jdt-specific
 ;;;
 (defclass eglot-eclipse-jdt (eglot-lsp-server) ()



reply via email to

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