diff options
author | David Morgan <djm_uk@protonmail.com> | 2022-11-18 12:07:38 +0000 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2022-11-18 12:07:38 +0000 |
commit | 6b55b3ab10305e8add1cd0b42fdf026e621727f7 (patch) | |
tree | 7e5be7927f01b549b18bbcc53bb7b070468c4eab | |
parent | d3c9ee1be95ee3a4115c24aad7ce6b6b47f268e1 (diff) | |
download | dotfiles-6b55b3ab10305e8add1cd0b42fdf026e621727f7.tar.gz |
Combine cider and lsp-mode completions
-rw-r--r-- | .emacs.d/lisp/init-clojure.el | 17 | ||||
-rw-r--r-- | .emacs.d/lisp/init-lsp.el | 8 |
2 files changed, 20 insertions, 5 deletions
diff --git a/.emacs.d/lisp/init-clojure.el b/.emacs.d/lisp/init-clojure.el index 50e26d3..0dcc2bd 100644 --- a/.emacs.d/lisp/init-clojure.el +++ b/.emacs.d/lisp/init-clojure.el @@ -22,6 +22,11 @@ ("ddb" "#d/dbg") ("dbn" "#d/dbgn"))) + (defalias 'cape-clojure (cape-super-capf #'cider-complete-at-point + #'lsp-completion-at-point)) + (defun set-clojure-capf () + (add-hook 'completion-at-point-functions #'cape-clojure -99 t)) + ;; https://github.com/weavejester/compojure/wiki/Emacs-indentation (define-clojure-indent (defroutes 'defun) @@ -46,7 +51,10 @@ (not (string= "project.clj" base))) (setq-local uniquify-min-dir-content 3)) (funcall orig base dirname depth original-dirname)) - (advice-add 'uniquify-get-proposed-name :around 'clj-uniquify-get-proposed-name)) + (advice-add 'uniquify-get-proposed-name :around 'clj-uniquify-get-proposed-name) + + :hook + (clojure-mode . set-clojure-capf)) (use-package clj-refactor :diminish @@ -69,6 +77,11 @@ (defun cider-repl-mode-hook-fn () (display-line-numbers-mode -1) (subword-mode +1)) + (defun cider-mode-hook-fn () + (eldoc-mode 1) + ;; Remove this, as we use cape-clojure (in init-clojure.el), which includes + ;; cider-complete-at-point + (remove-hook 'completion-at-point-functions #'cider-complete-at-point t)) (defun run-and-unhook () (remove-hook 'cider-connected-hook 'run-and-unhook) (run-main)) @@ -133,7 +146,7 @@ ("C-x 4 C->" . cider-find-dwim-other-window)) :hook (cider-repl-mode . cider-repl-mode-hook-fn) - (cider-mode . eldoc-mode)) + (cider-mode . cider-mode-hook-fn)) (provide 'init-clojure) ;;; init-clojure.el ends here diff --git a/.emacs.d/lisp/init-lsp.el b/.emacs.d/lisp/init-lsp.el index e2f249a..2cc8601 100644 --- a/.emacs.d/lisp/init-lsp.el +++ b/.emacs.d/lisp/init-lsp.el @@ -33,7 +33,10 @@ (remove-hook 'lsp-lens-mode-hook 'really-diminish-lsp-lens-mode)) (defun my/lsp-mode-setup-completion () (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults)) - '(orderless))) + '(orderless)) + ;; Remove this, as we use cape-clojure (in init-clojure.el), which includes + ;; lsp-completion-at-point + (remove-hook 'completion-at-point-functions #'lsp-completion-at-point t)) (if (eq system-type 'darwin) (setq lsp-keymap-prefix "s-l") (setq lsp-keymap-prefix "C-c C-l")) @@ -51,9 +54,8 @@ lsp-treemacs-theme "Iconless" lsp-completion-provider :none ;; use corfu lsp-references-exclude-definition t - ;; user cider for indendation, completion and eldoc instead + ;; user cider for indendation and eldoc lsp-enable-indentation nil - ;;lsp-completion-enable nil lsp-eldoc-enable-hover nil)) (provide 'init-lsp) |