machine_setup/ansible/roles/emacs/files/elisp/common-lsp.el
Tom Alexander ed7d4ab4e6
Run emacs garbage collection when idle.
This is to hopefully avoid running garbage collection while I am actively interacting with emacs, which should theoretically result in a smoother experience.
2024-01-26 21:21:09 -05:00

48 lines
1.5 KiB
EmacsLisp

(use-package eglot
:pin gnu
: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)
;; C-M-.
([remap xref-find-apropos] . #'consult-eglot-symbols)
)
;; :hook (
;; (eglot-managed-mode . (lambda ()
;; (when (eglot-managed-p)
;; (corfu-mode +1)
;; )
;; ))
;; )
:config
(fset #'jsonrpc--log-event #'ignore) ;; Disable logging LSP traffic for performance boost
(set-face-attribute 'eglot-highlight-symbol-face nil :background "#0291a1" :foreground "black")
(set-face-attribute 'eglot-mode-line nil :inherit 'mode-line :bold nil)
:custom
(eglot-autoshutdown t "Shut down server when last buffer is killed.")
(eglot-sync-connect 0 "Don't block on language server starting.")
(eglot-send-changes-idle-time 0.1)
)
(use-package consult-eglot
:commands (consult-eglot-symbols)
)
(use-package company
:after eglot
:hook (eglot-managed-mode . company-mode)
:config
(setq company-backends '((company-capf)))
(setq company-idle-delay 0) ;; Default 0.2
)
;; (use-package company-box
;; :hook (company-mode . company-box-mode))
(provide 'common-lsp)