From 0ca34af323923eb3e4081716c87064a8cfba348e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 1 Aug 2021 23:41:47 -0400 Subject: [PATCH] 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. --- modules/editor/file-templates/autoload.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/editor/file-templates/autoload.el b/modules/editor/file-templates/autoload.el index f0969963b..673b859fe 100644 --- a/modules/editor/file-templates/autoload.el +++ b/modules/editor/file-templates/autoload.el @@ -119,4 +119,10 @@ evil is loaded and enabled)." "Tests the current buffer and outputs the file template rule most appropriate for it. This is used for testing." (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))))