Skip to content

Commit 8d61f1b

Browse files
committed
company-semantic: add simple annotations
1 parent ed97b73 commit 8d61f1b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

company-semantic.el

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@
9999
(push tag company-semantic--current-tags)))
100100
(delete "" (mapcar 'semantic-tag-name company-semantic--current-tags)))
101101

102+
(defun company-semantic-annotation (argument tags)
103+
(let* ((tag (assoc argument tags))
104+
(kind (when tag (elt tag 1))))
105+
(cl-case kind
106+
(function (let* ((prototype (semantic-format-tag-prototype tag nil nil))
107+
(par-pos (string-match "(" prototype)))
108+
(when par-pos (substring prototype par-pos)))))))
109+
102110
(defun company-semantic--pre-prefix-length (prefix-length)
103111
"Sum up the length of all chained symbols before POS.
104112
Symbols are chained by \".\" or \"->\"."
@@ -133,6 +141,8 @@ Symbols are chained by \".\" or \"->\"."
133141
(company-semantic-completions arg)))
134142
(meta (funcall company-semantic-metadata-function
135143
(assoc arg company-semantic--current-tags)))
144+
(annotation (company-semantic-annotation arg
145+
company-semantic--current-tags))
136146
(doc-buffer (company-semantic-doc-buffer
137147
(assoc arg company-semantic--current-tags)))
138148
;; Because "" is an empty context and doesn't return local variables.

0 commit comments

Comments
 (0)