fix(snippets): fix snippet uuid completion
Rather than attempting to read the uuid from a text property on the selected completion -- which gets stripped by vertico (and possibly helm) -- grab it from a lookup alist of completion-candidat->uuid. Essentially the same as the proposed implementation by @jgrey4296 on #4127 Fix: #4127
This commit is contained in:
parent
5155f4aa78
commit
41f31ba9ce
1 changed files with 13 additions and 18 deletions
|
@ -45,10 +45,9 @@ Finds correctly active snippets from parent modes (based on Yas' logic)."
|
|||
return it))
|
||||
|
||||
(defun +snippet--completing-read-uuid (prompt all-snippets &rest args)
|
||||
(plist-get
|
||||
(text-properties-at
|
||||
0 (apply #'completing-read prompt
|
||||
(cl-loop for (_ . tpl) in (mapcan #'yas--table-templates (if all-snippets
|
||||
(let* ((completion-uuid-alist
|
||||
(cl-loop for (_ . tpl) in (mapcan #'yas--table-templates
|
||||
(if all-snippets
|
||||
(hash-table-values yas--tables)
|
||||
(yas--get-snippet-tables)))
|
||||
|
||||
|
@ -57,13 +56,9 @@ Finds correctly active snippets from parent modes (based on Yas' logic)."
|
|||
(yas--template-name tpl)
|
||||
(abbreviate-file-name (yas--template-load-file tpl)))
|
||||
collect
|
||||
(progn
|
||||
(set-text-properties 0 (length txt) `(uuid ,(yas--template-uuid tpl)
|
||||
path ,(yas--template-load-file tpl))
|
||||
txt)
|
||||
txt))
|
||||
args))
|
||||
'uuid))
|
||||
(cons txt (yas--template-uuid tpl))))
|
||||
(completion (apply #'completing-read prompt completion-uuid-alist args)))
|
||||
(alist-get completion completion-uuid-alist nil nil #'string=)))
|
||||
|
||||
(defun +snippet--abort ()
|
||||
(interactive)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue