[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master eef07a5 44/66: Support template functions in company-clang
From: |
Dmitry Gutov |
Subject: |
[elpa] master eef07a5 44/66: Support template functions in company-clang annotations |
Date: |
Tue, 13 Jan 2015 02:45:00 +0000 |
branch: master
commit eef07a5dda89d7af9f9d2838e8f773966b6d46c7
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Support template functions in company-clang annotations
Fixes #271
---
company-clang.el | 8 +++++++-
test/clang-tests.el | 14 ++++++++++++++
2 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/company-clang.el b/company-clang.el
index f30bf14..459056d 100644
--- a/company-clang.el
+++ b/company-clang.el
@@ -150,7 +150,13 @@ or automatically through a custom
`company-clang-prefix-guesser'."
((string-match "[^:]:[^:]" meta)
(substring meta (1+ (match-beginning 0))))
((string-match "\\((.*)[ a-z]*\\'\\)" meta)
- (match-string 1 meta)))))
+ (let ((paren (match-beginning 1)))
+ (if (not (eq (aref meta (1- paren)) ?>))
+ (match-string 1 meta)
+ (with-temp-buffer
+ (insert meta)
+ (goto-char paren)
+ (substring meta (1- (search-backward "<"))))))))))
(defun company-clang--strip-formatting (text)
(replace-regexp-in-string
diff --git a/test/clang-tests.el b/test/clang-tests.el
index 4d23a29..c8c03b7 100644
--- a/test/clang-tests.el
+++ b/test/clang-tests.el
@@ -9,3 +9,17 @@
(should (equal "createBookWithTitle:arg0 andAuthor:arg1"
(buffer-string)))
(should (looking-at "arg0"))
(should (null (overlay-get (company-template-field-at) 'display))))))
+
+(ert-deftest company-clang-simple-annotation ()
+ (let ((str (propertize
+ "foo" 'meta
+ "wchar_t * wmemchr(wchar_t *__p, wchar_t __c, size_t __n)")))
+ (should (equal (company-clang 'annotation str)
+ "(wchar_t *__p, wchar_t __c, size_t __n)"))))
+
+(ert-deftest company-clang-generic-annotation ()
+ (let ((str (propertize
+ "foo" 'meta
+ "shared_ptr<_Tp> make_shared<typename _Tp>(_Args &&__args...)")))
+ (should (equal (company-clang 'annotation str)
+ "<typename _Tp>(_Args &&__args...)"))))
- [elpa] master 996fbd2 24/66: Add company-bbdb-modes defcustom, (continued)
- [elpa] master 996fbd2 24/66: Add company-bbdb-modes defcustom, Dmitry Gutov, 2015/01/12
- [elpa] master 8d61f1b 35/66: company-semantic: add simple annotations, Dmitry Gutov, 2015/01/12
- [elpa] master ed97b73 34/66: company--insert-candidate: Don't change buffer modification status unnecessarily, Dmitry Gutov, 2015/01/12
- [elpa] master 6d023fd 36/66: Add NEWS entry, Dmitry Gutov, 2015/01/12
- [elpa] master 8d4ba7a 38/66: company-preview-show-at-point: Handle the pseudo-tooltip-overlay, Dmitry Gutov, 2015/01/12
- [elpa] master bd5e453 39/66: #267 follow-up fixes, Dmitry Gutov, 2015/01/12
- [elpa] master 7ac956a 37/66: Fix typo, Dmitry Gutov, 2015/01/12
- [elpa] master ccecb37 32/66: Merge pull request #252 from markus1189/bbdb-customize-group, Dmitry Gutov, 2015/01/12
- [elpa] master 6ff5ed3 40/66: Clear out unused variable warnings, Dmitry Gutov, 2015/01/12
- [elpa] master 8b587c0 43/66: Add .elpaignore, Dmitry Gutov, 2015/01/12
- [elpa] master eef07a5 44/66: Support template functions in company-clang annotations,
Dmitry Gutov <=
- [elpa] master 80620a1 45/66: Remove ineffective change from c6e9fbad312fc62876d40032a84a94439a055d05, Dmitry Gutov, 2015/01/12
- [elpa] master 829b40f 46/66: company--continue-failed: Don't burp on `stop', Dmitry Gutov, 2015/01/12
- [elpa] master 0a172c5 47/66: company-search-map: Support keypad numbers, Dmitry Gutov, 2015/01/12
- [elpa] master ff9bafc 41/66: Don't idle-begin when company-candidates is non-nil, Dmitry Gutov, 2015/01/12
- [elpa] master 9335f7b 48/66: company-search-delete-char: New command, Dmitry Gutov, 2015/01/12
- [elpa] master 048a9c4 50/66: company-search-old-map: Remove, unused, Dmitry Gutov, 2015/01/12
- [elpa] master a850cdb 51/66: Privatize some search functions (and a var), Dmitry Gutov, 2015/01/12
- [elpa] master 7b312dd 52/66: Introduce `company-search-toggle-filtering', Dmitry Gutov, 2015/01/12
- [elpa] master 0d2757c 56/66: company-search-map: Add M-n and M-p bindings, Dmitry Gutov, 2015/01/12
- [elpa] master f5942e9 55/66: company-fill-propertize: Don't highlight match beg till common part, Dmitry Gutov, 2015/01/12