switching back to lsp mode until eglot can handle multi-lsps
This commit is contained in:
parent
e39f351850
commit
449a736231
2 changed files with 45 additions and 2 deletions
45
config.el
45
config.el
|
@ -174,6 +174,47 @@
|
||||||
(after! vertico
|
(after! vertico
|
||||||
(vertico-mouse-mode))
|
(vertico-mouse-mode))
|
||||||
|
|
||||||
|
|
||||||
|
(after! lsp-mode
|
||||||
|
(setq lsp-signature-render-documentation nil)
|
||||||
|
|
||||||
|
(lsp-register-client
|
||||||
|
(make-lsp-client :new-connection (lsp-stdio-connection "nixd")
|
||||||
|
:major-modes '(nix-mode)
|
||||||
|
:priority 0
|
||||||
|
:server-id 'nixd)))
|
||||||
|
|
||||||
|
(defun lsp-booster--advice-json-parse (old-fn &rest args)
|
||||||
|
"Try to parse bytecode instead of json."
|
||||||
|
(or
|
||||||
|
(when (equal (following-char) ?#)
|
||||||
|
(let ((bytecode (read (current-buffer))))
|
||||||
|
(when (byte-code-function-p bytecode)
|
||||||
|
(funcall bytecode))))
|
||||||
|
(apply old-fn args)))
|
||||||
|
(advice-add (if (progn (require 'json)
|
||||||
|
(fboundp 'json-parse-buffer))
|
||||||
|
'json-parse-buffer
|
||||||
|
'json-read)
|
||||||
|
:around
|
||||||
|
#'lsp-booster--advice-json-parse)
|
||||||
|
|
||||||
|
(defun lsp-booster--advice-final-command (old-fn cmd &optional test?)
|
||||||
|
"Prepend emacs-lsp-booster command to lsp CMD."
|
||||||
|
(let ((orig-result (funcall old-fn cmd test?)))
|
||||||
|
(if (and (not test?) ;; for check lsp-server-present?
|
||||||
|
(not (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper
|
||||||
|
lsp-use-plists
|
||||||
|
(not (functionp 'json-rpc-connection)) ;; native json-rpc
|
||||||
|
(executable-find "emacs-lsp-booster"))
|
||||||
|
(progn
|
||||||
|
(when-let ((command-from-exec-path (executable-find (car orig-result)))) ;; resolve command from exec-path (in case not found in $PATH)
|
||||||
|
(setcar orig-result command-from-exec-path))
|
||||||
|
(message "Using emacs-lsp-booster for %s!" orig-result)
|
||||||
|
(cons "emacs-lsp-booster" orig-result))
|
||||||
|
orig-result)))
|
||||||
|
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
|
||||||
|
|
||||||
;; sly
|
;; sly
|
||||||
(after! sly
|
(after! sly
|
||||||
(setq sly-lisp-implementations
|
(setq sly-lisp-implementations
|
||||||
|
@ -203,7 +244,9 @@
|
||||||
(add-to-list 'auto-mode-alist '("\\.lsx\\'" . lisp-mode))
|
(add-to-list 'auto-mode-alist '("\\.lsx\\'" . lisp-mode))
|
||||||
|
|
||||||
(after! nix-mode
|
(after! nix-mode
|
||||||
(set-formatter! 'alejandra '("alejandra" "--quiet") :modes '(nix-mode)))
|
(set-formatter! 'alejandra '("alejandra" "--quiet") :modes '(nix-mode))
|
||||||
|
(setopt lsp-nix-nixd-server-path "nixd"
|
||||||
|
lsp-nix-nixd-formatting-command [ "nixpkgs-alejandra"]))
|
||||||
|
|
||||||
;; add platformio to ino files
|
;; add platformio to ino files
|
||||||
(add-to-list 'auto-mode-alist '("\\.ino\\'" . arduino-mode))
|
(add-to-list 'auto-mode-alist '("\\.ino\\'" . arduino-mode))
|
||||||
|
|
2
init.el
2
init.el
|
@ -72,7 +72,7 @@
|
||||||
ein ; tame Jupyter notebooks with emacs
|
ein ; tame Jupyter notebooks with emacs
|
||||||
(eval +overlay) ; run code, run (also, repls)
|
(eval +overlay) ; run code, run (also, repls)
|
||||||
(lookup +dictionary +offline +docsets) ; navigate your code and its documentation
|
(lookup +dictionary +offline +docsets) ; navigate your code and its documentation
|
||||||
(lsp +eglot) ; M-x vscode
|
lsp ; M-x vscode
|
||||||
magit ; a git porcelain for Emacs
|
magit ; a git porcelain for Emacs
|
||||||
make ; run make tasks from Emacs
|
make ; run make tasks from Emacs
|
||||||
pdf ; pdf enhancements
|
pdf ; pdf enhancements
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue