mirror of
https://github.com/jimeh/.emacs.d.git
synced 2026-02-19 13:46:41 +00:00
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.
39 lines
1.2 KiB
EmacsLisp
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
|