[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/company 57a6554 11/46: company-clang--parse-output: Fil
From: |
Dmitry Gutov |
Subject: |
[elpa] externals/company 57a6554 11/46: company-clang--parse-output: Filter out duplicates |
Date: |
Wed, 30 Dec 2020 18:33:03 -0500 (EST) |
branch: externals/company
commit 57a6554db750567917f1192463e2503787f9b883
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
company-clang--parse-output: Filter out duplicates
Fixes #841
Based on a patch by Gregory Heytings.
---
NEWS.md | 2 ++
company-clang.el | 21 ++++++++++++++++-----
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index ef0773e..dd7276a 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,8 @@
## Next
+* `company-clang` filters out duplicates
+ ([#841](https://github.com/company-mode/company-mode/issues/841)).
* New user option `company-tooltip-width-grow-only`.
* `company-xcode` has been removed. It has not been useful for years now.
* `company-clang` has been moved to after `company-capf` in the default value
of
diff --git a/company-clang.el b/company-clang.el
index 1460e09..df458c5 100644
--- a/company-clang.el
+++ b/company-clang.el
@@ -136,6 +136,7 @@ or automatically through a custom
`company-clang-prefix-guesser'."
(let ((pattern (format company-clang--completion-pattern
(regexp-quote prefix)))
(case-fold-search nil)
+ (results (make-hash-table :test 'equal :size (/ (point-max) 100)))
lines match)
(while (re-search-forward pattern nil t)
(setq match (match-string-no-properties 1))
@@ -144,11 +145,21 @@ or automatically through a custom
`company-clang-prefix-guesser'."
(when (string-match ":" match)
(setq match (substring match 0 (match-beginning 0)))))
(let ((meta (match-string-no-properties 2)))
- (when (and meta (not (string= match meta)))
- (put-text-property 0 1 'meta
- (company-clang--strip-formatting meta)
- match)))
- (push match lines)))
+ ;; Avoiding duplicates:
+ ;; https://github.com/company-mode/company-mode/issues/841
+ (cond
+ ;; Either meta != completion (not a macro)
+ ((not (equal match meta))
+ (puthash match meta results))
+ ;; Or it's the first time we see this completion
+ ((eq (gethash match results 'none) 'none)
+ (puthash match nil results))))))
+ (maphash
+ (lambda (match meta)
+ (when meta
+ (put-text-property 0 1 'meta (company-clang--strip-formatting meta)
match))
+ (push match lines))
+ results)
lines))
(defun company-clang--meta (candidate)
- [elpa] externals/company updated (24aefbd -> 123b604), Dmitry Gutov, 2020/12/30
- [elpa] externals/company 2158fbd 10/46: company-tooltip-width-grow-only: New option, Dmitry Gutov, 2020/12/30
- [elpa] externals/company c09e7ff 01/46: Remove unused variable, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 5eb7d86 07/46: Add some clarifications for the Customize interface, Dmitry Gutov, 2020/12/30
- [elpa] externals/company e1d5837 08/46: Use 'after-string' to render the popup, Dmitry Gutov, 2020/12/30
- [elpa] externals/company be8cf44 09/46: Tidy up a little, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 9e153fa 12/46: Restore Emacs < 26 compatibility, Dmitry Gutov, 2020/12/30
- [elpa] externals/company e393785 13/46: Add a FIXME, Dmitry Gutov, 2020/12/30
- [elpa] externals/company ca231bf 04/46: Remove company-eclim, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 10d7ee5 06/46: Remove company-xcode, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 57a6554 11/46: company-clang--parse-output: Filter out duplicates,
Dmitry Gutov <=
- [elpa] externals/company 520978c 02/46: Change the replacement character for non-printables, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 1b985d1 03/46: Set project-vc-merge-submodules to nil [ci skip], Dmitry Gutov, 2020/12/30
- [elpa] externals/company 664dd19 05/46: Move company-clang to after company-capf, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 54f60ef 14/46: Print the right buffer-local value, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 63b0535 15/46: Fixed badge url., Dmitry Gutov, 2020/12/30
- [elpa] externals/company d6df27f 17/46: Rename auto-complete to auto-commit, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 805637c 24/46: company-cmake: property completion candidates, Dmitry Gutov, 2020/12/30
- [elpa] externals/company c1e8972 18/46: company-selection: add company-selection-default to have better support for non-selection popup, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 25f6a27 26/46: company-echo-format: Handle company-common being nil, Dmitry Gutov, 2020/12/30
- [elpa] externals/company bbff400 27/46: Fix tooltip background stretching to EOL, Dmitry Gutov, 2020/12/30