switch back to eglot with eglot-booster

This commit is contained in:
Mars 2024-10-07 23:43:23 -04:00
parent 41d3ea0a24
commit c11a2f29d0
Signed by: pupbrained
GPG key ID: 0FF5B8826803F895

View file

@ -224,6 +224,7 @@
(general-define-key (general-define-key
:states '(normal visual emacs) :states '(normal visual emacs)
:keymaps 'override :keymaps 'override
"K" '(eldoc-box-help-at-point :wk "Hover")
"C-t" '(vterm-toggle :wk "Toggle VTerm"))) "C-t" '(vterm-toggle :wk "Toggle VTerm")))
(use-package evil-collection (use-package evil-collection
@ -239,8 +240,11 @@
(evil-leader/set-key "bb" #'switch-to-buffer) (evil-leader/set-key "bb" #'switch-to-buffer)
(evil-leader/set-key "bd" #'kill-this-buffer) (evil-leader/set-key "bd" #'kill-this-buffer)
(evil-leader/set-key "e" #'dirvish-side) (evil-leader/set-key "e" #'dirvish-side)
(evil-leader/set-key "N" #'lsp-bridge-diagnostic-jump-prev) (evil-leader/set-key "d" #'flymake-show-diagnostic)
(evil-leader/set-key "n" #'lsp-bridge-diagnostic-jump-next)) (evil-leader/set-key "n" #'flymake-goto-next-error)
(evil-leader/set-key "N" #'flymake-goto-prev-error)
(evil-leader/set-key "n" #'flymake-goto-next-error)
(evil-leader/set-key "a" #'eglot-code-actions))
(use-package catppuccin-theme (use-package catppuccin-theme
:ensure t :ensure t
@ -266,49 +270,59 @@
** LSP ** LSP
*** LSP-Bridge *** Eglot
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package yasnippet (use-package eglot-booster
:ensure t :after eglot
:init :ensure (eglot-booster :type git :host github :repo "jdtsmith/eglot-booster")
(yas-global-mode 1)) :config (eglot-booster-mode))
(use-package lsp-bridge (use-package eglot
:ensure '(lsp-bridge :type git :host github :repo "manateelazycat/lsp-bridge" :files (:defaults "*")) :ensure nil
:init :config
(defun lsp-bridge-mode-hook-func () (defun my-eglot-rename (newname)
(local-set-key (kbd "M-[") #'lsp-bridge-return-from-def) "Rename the current symbol to NEWNAME with initial input a."
(local-set-key (kbd "M-]") #'lsp-bridge-find-def) (interactive
(local-set-key [remap xref-find-definitions] #'lsp-bridge-find-def) (list (read-from-minibuffer
(local-set-key [remap xref-find-definitions-other-window] #'lsp-bridge-find-def-other-window) (format "Rename `%s' to: " (or (thing-at-point 'symbol t)
(local-set-key [remap xref-find-references] #'lsp-bridge-find-references) (error "no symbol at point")))
(or (thing-at-point 'symbol t) "") nil nil nil
(symbol-name (symbol-at-point)))))
(eglot--server-capable-or-lose :renameProvider)
(eglot--apply-workspace-edit
(jsonrpc-request (eglot--current-server-or-lose)
:textDocument/rename `(,@(eglot--TextDocumentPositionParams)
:newName ,newname))
current-prefix-arg))
(fset #'jsonrpc--log-event #'ignore)
(setopt eglot-events-buffer-size 0)
(defun eglot-format-buffer-on-save ()
(when (not (derived-mode-p 'python-ts-mode))
(add-hook 'before-save-hook #'eglot-format-buffer -10 t)))
(add-hook 'eglot-managed-mode-hook #'eglot-format-buffer-on-save)
:hook
(rust-mode . eglot-ensure)
(rust-ts-mode . eglot-ensure)
(sh-script-mode . eglot-ensure)
(python-mode . eglot-ensure)
(python-ts-mode . eglot-ensure)
(json-mode . eglot-ensure)
(json-ts-mode . eglot-ensure)
(yaml-mode . eglot-ensure)
(yaml-ts-mode . eglot-ensure)
(c-mode . eglot-ensure)
(c-ts-mode . eglot-ensure)
(c++-mode . eglot-ensure)
(c++-ts-mode . eglot-ensure)
(go-mode . eglot-ensure)
(go-ts-mode . eglot-ensure))
(evil-define-key 'normal 'local (kbd "gd") #'lsp-bridge-find-def) (use-package eldoc-box
(evil-define-key 'normal 'local (kbd "gD") #'lsp-bridge-find-def-other-window) :custom
(evil-define-key 'normal 'local (kbd "gi") #'lsp-bridge-find-impl) (eldoc-box-max-pixel-width 1024)
(evil-define-key 'normal 'local (kbd "gI") #'lsp-bridge-find-impl-other-window) :config
(evil-define-key 'normal 'local (kbd "gr") #'lsp-bridge-find-references) (setq eldoc-idle-delay 0))
(evil-define-key 'normal 'local (kbd "K") #'lsp-bridge-popup-documentation))
(setq lsp-bridge-enable-log t
lsp-bridge-enable-inlay-hint t
lsp-bridge-nix-lsp-server "nil"
acm-enable-icon t
acm-enable-doc t
acm-enable-copilot t
acm-enable-quick-access t
acm-completion-backend-merge-order '("codeium-candidates"
"mode-first-part-candidates"
"template-first-part-candidates"
"template-second-part-candidates"
"mode-second-part-candidates"))
(require 'lsp-bridge)
(evil-set-initial-state 'lsp-bridge-ref-mode 'insert)
(add-hook 'lsp-bridge-mode-hook #'lsp-bridge-mode-hook-func)
(add-hook 'prog-mode-hook #'lsp-bridge-mode))
#+end_src #+end_src
*** Apheleia *** Apheleia