emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 4af1ea2 12/38: company-yasnippet: Make annotation more cus


From: Dmitry Gutov
Subject: [elpa] master 4af1ea2 12/38: company-yasnippet: Make annotation more customizable
Date: Sat, 25 Jul 2020 19:51:12 -0400 (EDT)

branch: master
commit 4af1ea2269fd41567bcd98da62461172cc0f1cd9
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    company-yasnippet: Make annotation more customizable
    
    https://github.com/company-mode/company-mode/pull/965#issuecomment-599522340
---
 company-yasnippet.el | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/company-yasnippet.el b/company-yasnippet.el
index cc12eb2..c10ec2e 100644
--- a/company-yasnippet.el
+++ b/company-yasnippet.el
@@ -35,6 +35,14 @@
 (declare-function yas--template-expand-env "yasnippet")
 (declare-function yas--warning "yasnippet")
 
+(defvar company-yasnippet-annotation-fn
+  (lambda (name)
+    (concat
+     (unless company-tooltip-align-annotations " -> ")
+     name))
+  "Function to format completion annotation.
+It has to accept one argument: the snippet's name.")
+
 (defun company-yasnippet--key-prefixes ()
   ;; Mostly copied from `yas--templates-for-key-at-point'.
   (defvar yas-key-syntaxes)
@@ -146,9 +154,8 @@ shadow backends that come after it.  Recommended usages:
      (and (bound-and-true-p yas-minor-mode)
           (company-grab-symbol)))
     (annotation
-     (concat
-      (unless company-tooltip-align-annotations " -> ")
-      (get-text-property 0 'yas-annotation arg)))
+     (funcall company-yasnippet-annotation-fn
+              (get-text-property 0 'yas-annotation arg)))
     (candidates (company-yasnippet--candidates arg))
     (doc-buffer (company-yasnippet--doc arg))
     (no-cache t)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]