machine_setup/ansible/roles/emacs/files/elisp/common-lsp.el

37 lines
1.2 KiB
EmacsLisp
Raw Normal View History

2022-10-20 04:03:56 +00:00
(use-package eglot
:pin gnu
2022-10-20 04:03:56 +00:00
:commands (eglot eglot-ensure)
:bind (:map eglot-mode-map
;; M-.
;; ([remap xref-find-definitions] . lsp-ui-peek-find-definitions)
;; M-?
;; ([remap xref-find-references] . lsp-ui-peek-find-references)
("C-c C-a" . eglot-code-actions)
2023-09-08 15:55:56 +00:00
;; C-M-.
([remap xref-find-apropos] . #'consult-eglot-symbols)
2022-10-20 04:03:56 +00:00
)
:hook (
(eglot-managed-mode . (lambda ()
(when (eglot-managed-p)
(corfu-mode +1)
)
))
)
:config
2023-09-08 15:55:56 +00:00
(fset #'jsonrpc--log-event #'ignore) ;; Disable logging LSP traffic for performance boost
2022-10-20 04:03:56 +00:00
(set-face-attribute 'eglot-highlight-symbol-face nil :background "#0291a1" :foreground "black")
(set-face-attribute 'eglot-mode-line nil :inherit 'mode-line :bold nil)
2023-09-08 15:55:56 +00:00
2022-10-20 04:03:56 +00:00
:custom
(eglot-autoshutdown t "Shut down server when last buffer is killed.")
(eglot-sync-connect 0 "Don't block on language server starting.")
2023-09-08 15:55:56 +00:00
(eglot-send-changes-idle-time 0.1)
)
(use-package consult-eglot
:commands (consult-eglot-symbols)
2022-10-20 04:03:56 +00:00
)
(provide 'common-lsp)