feat(file-templates): improve diagnostic command

Emit a more helpful error message if a rule was found but yasnippet
can't find the associated snippet.
This commit is contained in:
Henrik Lissner 2021-08-01 23:41:47 -04:00
parent 425f6a1264
commit 0ca34af323

View file

@ -119,4 +119,10 @@ evil is loaded and enabled)."
"Tests the current buffer and outputs the file template rule most appropriate "Tests the current buffer and outputs the file template rule most appropriate
for it. This is used for testing." for it. This is used for testing."
(interactive) (interactive)
(message "Found %s" (cl-find-if #'+file-template-p +file-templates-alist))) (let ((template (cl-find-if #'+file-template-p +file-templates-alist)))
(if (cl-find trigger (yas--all-templates
(yas--get-snippet-tables
(plist-get template :mode)))
:key #'yas--template-key :test #'equal)
(message "Found %s" template)
(message "Found rule, but can't find associated snippet: %s" template))))