feat(emacs/lean-company): truncate type info in auto-complete

Close #137
This commit is contained in:
Soonho Kong 2014-09-05 06:51:05 -07:00
parent 64bae94d3a
commit fc364566bf

View file

@ -48,7 +48,18 @@ triggers a completion immediately."
(defun company-lean--annotation (candidate)
(let ((type (get-text-property 0 'type candidate)))
(when type
(format " : %s" type))))
(let* ((annotation-str (format " : %s" type))
(annotation-len (length annotation-str))
(candidate-len (length candidate))
(entry-width (+ candidate-len
annotation-len))
(window-width (window-body-width)))
(when (> entry-width window-width)
(setq annotation-str
(substring-no-properties annotation-str
0
(- window-width candidate-len))))
annotation-str))))
;;;###autoload
(defun company-lean (command &optional arg &rest ignored)