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

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

[elpa] externals/company cecf554 1/5: (margin): Add tty compatible margi


From: ELPA Syncer
Subject: [elpa] externals/company cecf554 1/5: (margin): Add tty compatible margin function
Date: Wed, 31 Mar 2021 12:57:08 -0400 (EDT)

branch: externals/company
commit cecf554e7bf9e336a97c2ba3fc430e228b11737b
Author: Mohsin Kaleem <mohkale@kisara.moe>
Commit: Mohsin Kaleem <mohkale@kisara.moe>

    (margin): Add tty compatible margin function
    
    See 
[[https://github.com/company-mode/company-mode/issues/756#issuecomment-810306170][#756]].
---
 company.el | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/company.el b/company.el
index 1a915aa..c9e70ae 100644
--- a/company.el
+++ b/company.el
@@ -1448,6 +1448,45 @@ end of the match."
                                 candidate
                                 selected))
 
+(defvar company-unicode-icons-mapping
+  '((array . "Α")
+    (boolean . "β")
+    (class . "γ")
+    (color . "Δ")
+    (constant . "ε")
+    (enum-member . "ζ")
+    (enum . "Ζ")
+    (event . "η")
+    (field . "θ")
+    (file . "Ɩ")
+    (folder . "⍳")
+    (interface . "ϰ")
+    (key . "μ")
+    (keyword . "ν")
+    (method . "λ")
+    (function . "ƒ")
+    (misc . "ξ")
+    (module . "Ο")
+    (numeric . "π")
+    (operator . "⊙")
+    (parameter . "ρ")
+    (property . "σ")
+    (ruler . "τ")
+    (snippet . "υ")
+    (string . "φ")
+    (struct . "Χ")
+    (variable . "ѱ")))
+
+(defun company-unicode-icons-margin (candidate selected)
+  "Margin function which returns icons from vscode's light theme."
+  (when-let ((candidate candidate)
+             (kind (company-call-backend 'kind candidate))
+             (icon (alist-get kind company-unicode-icons-mapping)))
+    (propertize icon
+                'face (if selected
+                          'company-tooltip-selection
+                        'company-tooltip))))
+
 (defcustom company-format-margin-function nil
   "Function to format the margin.
 It accepts 2 params `candidate' and `selected' and can be used for



reply via email to

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