Set up eglot for ruby and bash

This commit is contained in:
Jeremy Isaac Dormitzer 2024-03-20 12:02:40 -04:00
parent a3eb134450
commit 3890c5fb90

View File

@ -58,6 +58,17 @@
`(html-web-mode . ,(eglot-alternatives `(html-web-mode . ,(eglot-alternatives
'(("vscode-html-language-server" "--stdio") '(("vscode-html-language-server" "--stdio")
("html-languageserver" "--stdio"))))) ("html-languageserver" "--stdio")))))
(add-to-list 'eglot-server-programs
`((ruby-mode ruby-ts-mode) . ,(eglot-alternatives
'(("srb" "typecheck" "--lsp")
("solargraph" "socket" "--port" :autoport)))))
;; Sorbet passes an out-of-spec key in its connection JSON, filter it out to prevent eglot blowing up
(cl-defun jsonrpc-connection-receive--filter-args ((conn foreign-message) &rest args)
(let ((msg (cl-loop for (k v) on foreign-message by #'cddr
if (-contains? '(:method :id :error :params :result :jsonrpc) k)
collect k and collect v)))
(append (list conn msg) args)))
(advice-add 'jsonrpc-connection-receive :filter-args #'jsonrpc-connection-receive--filter-args)
(defvar eglot-java-java-agent nil (defvar eglot-java-java-agent nil
"Java agent JVM arg for eglot JDTLS.") "Java agent JVM arg for eglot JDTLS.")
;; Custom eglot java server for deeper customization ;; Custom eglot java server for deeper customization
@ -194,8 +205,12 @@
(c-mode . eglot-ensure) (c-mode . eglot-ensure)
(terraform-mode . eglot-ensure) (terraform-mode . eglot-ensure)
(ruby-mode . eglot-ensure) (ruby-mode . eglot-ensure)
(ruby-ts-mode . eglot-ensure)
(sh-mode . eglot-ensure)
(bash-ts-mode . eglot-ensure)
:custom :custom
(eglot-confirm-server-initiated-edits nil)) (eglot-confirm-server-initiated-edits nil)
(eglot-connect-timeout nil))
;; Some compilation-mode conveniences ;; Some compilation-mode conveniences
(use-package compile (use-package compile