cdbbeea18a9769404c27711ae2a4871a4e931e0b — Gerry Agbobada 2 months ago 800283b
Use emacs-lsp-booster when found
1 files changed, 36 insertions(+), 0 deletions(-)

M config.el
M config.el => config.el +36 -0
@@ 669,6 669,42 @@
;;; Experimental zone

;;;; LSP Booster
(when (executable-find "emacs-lsp-booster") ; cargo install --git https://github.com/blahgeek/emacs-lsp-booster

  (defun lsp-booster--advice-json-parse (old-fn &rest args)
    "Try to parse bytecode instead of json."
     (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))

  (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
               (not (functionp 'json-rpc-connection))  ;; native json-rpc
               (executable-find "emacs-lsp-booster"))
            (message "Using emacs-lsp-booster for %s!" orig-result)
            (cons "emacs-lsp-booster" orig-result))

  (advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command))

;;;; Multi vterm

(use-package! multi-vterm
  (multi-vterm-buffer-name "Terminal")