;; TODO: How to handle OVERLOAD and Pattern?
(defconst company-clang--completion-pattern
- "^COMPLETION: \\_<\\(%s[a-zA-Z0-9_:]*\\)")
+ "^COMPLETION: \\_<\\(%s[a-zA-Z0-9_:]*\\)\\(?: : \\(.*\\)$\\)?")
(defconst company-clang--error-buffer-name "*clang error*")
+(defvar company-clang--meta-cache nil)
+
(defun company-clang--parse-output (prefix)
(goto-char (point-min))
(let ((pattern (format company-clang--completion-pattern
(regexp-quote prefix)))
(case-fold-search nil)
lines match)
+ (setq company-clang--meta-cache (make-hash-table :test 'equal))
(while (re-search-forward pattern nil t)
(setq match (match-string-no-properties 1))
+ (let ((meta (match-string-no-properties 2)))
+ (when (and meta (not (string= match meta)))
+ (puthash match meta company-clang--meta-cache)))
(unless (equal match "Pattern")
(push match lines)))
lines))
(not (company-in-string-or-comment))
(or (company-grab-symbol) 'stop)))
(candidates (company-clang--candidates arg))
+ (meta (let ((meta (gethash arg company-clang--meta-cache)))
+ (when meta
+ (replace-regexp-in-string
+ "#]" " "
+ (replace-regexp-in-string "[<{[]#\\|#[>}]" "" meta t)
+ t))))
(post-completion (and (derived-mode-p 'objc-mode)
(string-match ":" arg)
(company-clang-objc-templatify arg)))))
;; accidentally when it's enabled.
;; Fixed two old tooltip annoyances.
;; Some performance improvements.
+;; `company-clang' now shows meta information, too.
;;
;; 2010-02-24 (0.5)
;; `company-ropemacs' now provides location and docs. (Fernando H. Silva)