mirror of
https://github.com/jimeh/.emacs.d.git
synced 2026-02-19 13:46:41 +00:00
fix(completion): ensure correct order of completion-at-point-functions
When lsp-mode is active, it tries to ensure it's own lsp-completion-at-point function is listed before any other functions in completion-at-point-functions. This however prevents completions for yasnippet snippets and files/folders from working, as completion never moved on beyond lsp-completion-at-point. Previously I had managed to fix this by using the DEPTH option of add-hook to get siren-yasnippet-capf and cape-file to run before lsp-completion-at-point. But it seems lsp-mode has changed from using add-hook to a more custom method of always ensuring lsp-completion-at-point is always first on the list. Hence we need to the same using the new siren-prepend macro I recently added.
This commit is contained in:
@@ -21,8 +21,11 @@
|
||||
(siren-cape-capf-add-hooks t))
|
||||
|
||||
(defun siren-cape-capf-add-hooks (&optional local)
|
||||
(add-hook 'completion-at-point-functions 'siren-yasnippet-capf -65 local)
|
||||
(add-hook 'completion-at-point-functions 'cape-file -10 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 'siren-yasnippet-capf))
|
||||
|
||||
(defun siren-cape-capf-remove-hooks (&optional local)
|
||||
(remove-hook 'completion-at-point-functions 'siren-yasnippet-capf local)
|
||||
|
||||
Reference in New Issue
Block a user