Reconfigure Elixir LSP server a little bit
All checks were successful
/ Test config on 20 (push) Successful in 32s

This commit is contained in:
Maciej 2026-04-29 11:12:51 +03:00
parent 1c0165a510
commit e7d2eb2271
Signed by: maciej
GPG key ID: 28243AF437E32F99
4 changed files with 46 additions and 18 deletions

View file

@ -8,6 +8,7 @@
(declare-function cape-file 'cape)
(declare-function cape-keyword 'cape)
(declare-function cape-elisp-symbol 'cape)
(declare-function cape-capf-prefix-length 'cape)
(declare-function cape-capf-super 'cape)
(declare-function yasnippet-capf 'yasnippet)
(declare-function nerd-icons-corfu-formatter 'nerd-icons-corfu)
@ -29,7 +30,7 @@
:config
;; Go up to go the the last item on the list
(setopt corfu-cycle t
corfu-count 20 ;; Show 20 completion candidates
corfu-count 20 ;; Show 20 completion candidates
corfu-max-width 100 ;; Max width of the corfu frame
corfu-right-margin-width 0.5
corfu-left-margin-width 0.5
@ -72,18 +73,18 @@
"Set `completion-at-point-function` to list where LSP is supported."
(setq-local completion-at-point-functions
(list
(cape-capf-super #'yasnippet-capf #'eglot-completion-at-point)
#'cape-dabbrev
#'cape-file)))
(cape-capf-super #'yasnippet-capf #'eglot-completion-at-point)
#'cape-dabbrev
#'cape-file)))
(defun icejam-set-elisp-capfs ()
"Set `completion-at-point-function` to what is useful in Elisp."
(setq-local completion-at-point-functions
(list (cape-capf-super #'elisp-completion-at-point
#'yasnippet-capf)
#'cape-dabbrev
#'cape-file
#'cape-elisp-symbol)))
#'yasnippet-capf)
#'cape-dabbrev
#'cape-file
#'cape-elisp-symbol)))
(use-package yasnippet-capf :ensure t :after corfu :defer t
:config

View file

@ -3,10 +3,44 @@
;;; Global Language Server Protocol Config
;;; Code:
(eval-when-compile
(declare-function eglot-completion-at-point 'eglot)
(declare-function eglot-managed-p 'eglot))
(use-package eglot :ensure nil
:config
;; Use Ruby-Lsp instead of Solargraph
(add-to-list 'eglot-server-programs '((ruby-mode ruby-ts-mode) "ruby-lsp")))
(add-to-list 'eglot-server-programs '((ruby-mode ruby-ts-mode) "ruby-lsp"))
(setopt eglot-advertise-cancellation t)
;; Automatically kill eglot when last buffer associated with a project is
;; closed.
(setopt eglot-autoshutdown t)
;; Set up server specific switches globally
(setq-default eglot-workspace-configuration
;; Elixir configuration
'(:elixirLS (
:autoBuild t
:dialyzerEnabled t
:incrementalDialyzer :json-false
:autoInsertRequiredAlias :json-false
:suggestSpecs t
)))
;; Eglot insists on adding itself to the completion-at-point-functions but
;; that means that it overrides our combined value of (eglot + yasnippet)
(add-hook 'eglot-managed-mode-hook
(lambda ()
(when eglot--managed-mode
(remove-hook 'completion-at-point-functions
#'eglot-completion-at-point t)))))
(defun icejam-start-eglot ()
"Start eglot unless already started."
(unless (eglot-managed-p)
(eglot-ensure)))
(use-package eldoc-box
:ensure (:host github :repo "casouri/eldoc-box")

View file

@ -10,6 +10,7 @@
(declare-function yas--remove-template-by-uuid 'yasnippet)
(declare-function icejam-set-indent 'icejam-prog-mode)
(declare-function icejam-set-eglot-capfs 'icejam-complete-at-point)
(declare-function icejam-start-eglot 'icejam-eglot)
(defvar icejam-language-transient-alist)
(defvar icejam-elixir-lang-menu)
(defvar apheleia-mode-alist))
@ -44,9 +45,8 @@
"All things Elixir."
(icejam-set-indent 2)
(column-enforce-n 98)
(eglot-ensure)
(icejam-set-eglot-capfs)
(icejam-start-eglot)
(icejam-delete-elixir-snippets))
(add-hook 'heex-ts-mode-hook 'icejam-activate-elixir-ts-mode)