Files
.emacs.d/modules/completion/siren-cape.el
Jim Myhrberg f70de31989 fix(completion/yasnippet): fix completion issues caused by yasnippet
This somewhat works around some changes to cape, which I was abusing to
effectively get a capf yasnippet function that would only return results
on exact matches. This allows normal lsp completion to work just fine,
except for exact matches against specific snippets.

Now we use the yasnippet-capf package instead, no longer needing the
company-yasnippet package, and hacking it to also only give a single
result back, with some caveats.
2024-10-18 02:47:37 +01:00

39 lines
1.2 KiB
EmacsLisp

;;; siren-cape.el --- jimeh's Emacs Siren: cape configuration.
;;; Commentary:
;; Basic configuration for cape. Auto completion on steroids.
;;; Code:
(require 'siren-company)
(require 'siren-yasnippet)
(use-package cape
:after company
:hook
(lsp-completion-mode . siren-cape-capf-lsp-mode-setup)
:preface
(defun siren-cape-capf-lsp-mode-setup ()
(siren-cape-capf-add-hooks t))
(defun siren-cape-capf-add-hooks (&optional local)
(if local (make-local-variable 'completion-at-point-functions))
;; Use `siren-prepend' function instead of `add-hook' to ensure our custom
;; completion functions are listed before `lsp-completion-at-point'.
(siren-prepend completion-at-point-functions 'cape-file)
(siren-prepend completion-at-point-functions 'yasnippet-capf))
;; (siren-prepend completion-at-point-functions
;; (cape-capf-super #'lsp-completion-at-point #'yasnippet-capf))
(defun siren-cape-capf-remove-hooks (&optional local)
(remove-hook 'completion-at-point-functions 'cape-file local)
(remove-hook 'completion-at-point-functions 'yasnippet-capf local))
:init
(siren-cape-capf-add-hooks))
(provide 'siren-cape)
;;; siren-cape.el ends here