-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve documentation for embark integration #12
Comments
Since that ticket was created embark went through a few refactorings and as you mentioned the snippet from their no longer works. For reference this is what I have in my config for embark: (use-package consult-yasnippet
:straight t
:config
(with-eval-after-load 'embark
;; Embark actions for `consult-yasnippet' and derivatives.
(general-define-key
:keymaps 'embark-yasnippet-completion-actions
"d" 'consult-yasnippet-visit-snippet-file ; NOTE: Binding differs from `ivy-yasnippet' which uses "v".
"g" 'consult-yasnippet-visit-snippet-file ; NOTE: Binding differs from `ivy-yasnippet' which uses "v".
)
(push '(yasnippet . embark-yasnippet-completion-actions)
embark-keymap-alist))
:general
(:states '(insert normal)
"C-M-i" 'consult-yasnippet)) I'd be more than happy to accept a PR adding more info to the README about embark integration.
There isn't anything in this project that's marginalia specific. We use consult and set an annotation function. If marginalia is installed it should integrate with whatever completion UI you're using. If not then it won't. I'd be happy to accept a PR describing this to the README as well, but am unsure what other integration you could be referring to 🤔. |
I'll be happy to provide a PR as soon as I get something working. Unfortunately the snippet above doesn't work for me either, It seems that I did try adding it to the keymap (use-package consult-yasnippet
:straight t
:config
(with-eval-after-load 'embark
(general-def embark-consult-search-map
"y" 'consult-yasnippet))) |
The ticket I linked to contains the following snippet under a heading "Marginalia". (require 'marginalia)
(defun marginalia-annotate-yasnippet (cand)
;; NOTE: Maybe there's a less indirect way to do this :/.
(when-let* ((cand (marginalia--full-candidate cand))
(template (alist-get cand consult-yasnippet--snippets nil nil #'string-equal))
(key (yas--template-key template)))
(concat " " (propertize (concat "[" key "]")
;; TODO: custom face
'face 'font-lock-type-face))))
(push '(yasnippet . marginalia-annotate-yasnippet) marginalia-annotators-light)
(push '(yasnippet . marginalia-annotate-yasnippet) marginalia-annotators-heavy) All I meant was that it probably would be nice to also have this in the README of |
That shouldn't be necessary. All that does is suffix the snippet candidate with the short-string that expands to it. All candidates in consult-yasnippet do that now automatically (it was changed because otherwise you couldn't filter on the snippet key, only the snippet name). |
As I'm not succeeding in hooking consult-yasnippet into embark I'm removing it from my configuration. I'll keep an eye on the project to see how it progresses, but as it is now I don't really have much use for it. |
The description for integrating with embark that I found in a ticket on consult doesn't seem to work, using
embark-define-keymap
results in an error and I'm told to usedefvar-keymap
. I made a naive attempt to usedefvar-keymap
, but it doesn't make any change to the list of embark actions.I think it'd be a good idea to put a (working) snippet for embark integration into the README. (I think the same goes for the marginalia integration too, actually.)
The text was updated successfully, but these errors were encountered: