[eglot] Add support for eglot lsp client in emacs

- Update README
- Add eglot-specifics to cc, rs, py, hs
  removing unused lsp-mode packages when eglot is active
- Add eglot-specific bindings
- Add doctor warnings for debugger +lsp and +peek
- Add eglot-backed lookup-handlers
- Add flycheck checker using eglot for :checkers
  syntax users (using flycheck/flycheck#1676 and
  flycheck/flycheck#1592 discussion).
  This implementation is based on @marsam code, and uses recent
  Flycheck development in order to make the code smaller and
  easier to maintain.
This commit is contained in:
Gerry Agbobada 2020-05-01 11:01:11 +02:00 committed by Gerry Agbobada
parent f2a3dee7ff
commit 3e5b7cce3f
No known key found for this signature in database
GPG key ID: BE26DBAFD866BE34
18 changed files with 248 additions and 47 deletions

View file

@ -236,9 +236,45 @@ If rtags or rdm aren't available, fail silently instead of throwing a breaking e
(setq-local company-lsp-cache-candidates nil)
(lsp!))))
(when (and (featurep! +lsp) (featurep! :tools lsp +eglot))
;; TODO : test this value
;; IS-MAC custom configuration
(when IS-MAC
(add-to-list 'eglot-workspace-configuration
((:ccls . ((:clang . ,(list :extraArgs ["-isystem/Library/Developer/CommandLineTools/usr/include/c++/v1"
"-isystem/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"
"-isystem/usr/local/include"]
:resourceDir (string-trim (shell-command-to-string "clang -print-resource-dir")))))))))
;; Eglot specific helper, courtesy of MaskRay
(defun eglot-ccls-inheritance-hierarchy (&optional derived)
"Show inheritance hierarchy for the thing at point.
If DERIVED is non-nil (interactively, with prefix argument), show
the children of class at point."
(interactive "P")
(if-let* ((res (jsonrpc-request
(eglot--current-server-or-lose)
:$ccls/inheritance
(append (eglot--TextDocumentPositionParams)
`(:derived ,(if derived t :json-false))
'(:levels 100) '(:hierarchy t))))
(tree (list (cons 0 res))))
(with-help-window "*ccls inheritance*"
(with-current-buffer standard-output
(while tree
(pcase-let ((`(,depth . ,node) (pop tree)))
(cl-destructuring-bind (&key uri range) (plist-get node :location)
(insert (make-string depth ?\ ) (plist-get node :name) "\n")
(make-text-button (+ (point-at-bol 0) depth) (point-at-eol 0)
'action (lambda (_arg)
(interactive)
(find-file (eglot--uri-to-path uri))
(goto-char (car (eglot--range-region range)))))
(cl-loop for child across (plist-get node :children)
do (push (cons (1+ depth) child) tree)))))))
(eglot--error "Hierarchy unavailable"))))
(use-package! ccls
:when (featurep! +lsp)
:when (and (featurep! +lsp) (not (featurep! :tools lsp +eglot)))
:after lsp
:init
(after! projectile