[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/company c8a06ff3bf 11/30: Support completion styles in
From: |
ELPA Syncer |
Subject: |
[elpa] externals/company c8a06ff3bf 11/30: Support completion styles in company-etags too |
Date: |
Sat, 13 Jul 2024 00:57:50 -0400 (EDT) |
branch: externals/company
commit c8a06ff3bfc1d114abe123c48205fcfafa9cbd6c
Author: Dmitry Gutov <dmitry@gutov.dev>
Commit: Dmitry Gutov <dmitry@gutov.dev>
Support completion styles in company-etags too
---
NEWS.md | 2 ++
company-etags.el | 38 +++++++++++++++++++++++++++++---------
2 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index b53f1177cf..b176e71207 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -39,6 +39,8 @@
company-dabbrev-code-completion-styles '(basic flex))
```
+* New user option `company-etags-completion-styles`, to be used the same way.
+
* The backend command `keep-prefix` is being phased out. The built-in backends
implement it internally now, which resolved a number of sharp edges (mostly)
around "grouped" backends. To make that easier, several helpers were added,
diff --git a/company-etags.el b/company-etags.el
index a5dd65a6f7..e1da516831 100644
--- a/company-etags.el
+++ b/company-etags.el
@@ -1,6 +1,6 @@
;;; company-etags.el --- company-mode completion backend for etags -*-
lexical-binding: t -*-
-;; Copyright (C) 2009-2011, 2013-2015, 2018-2019, 2023 Free Software
Foundation, Inc.
+;; Copyright (C) 2009-2011, 2013-2015, 2018-2019, 2023-2024 Free Software
Foundation, Inc.
;; Author: Nikolaj Schumacher
@@ -54,10 +54,17 @@ Set it to t or to a list of major modes."
(symbol :tag "Major mode")))
:package-version '(company . "0.9.0"))
+(defcustom company-etags-completion-styles nil
+ "Non-nil to use the completion styles for fuzzy matching."
+ :type '(choice (const :tag "Prefix matching only" nil)
+ (const :tag "Matching according to `completion-styles'" t)
+ (list :tag "Custom list of styles" symbol)))
+
(defvar company-etags-modes '(prog-mode c-mode objc-mode c++-mode java-mode
jde-mode pascal-mode perl-mode python-mode))
(defvar-local company-etags-buffer-table 'unknown)
+(defvar-local company-etags--boundaries nil)
(defun company-etags-find-table ()
(let ((file (expand-file-name
@@ -74,18 +81,28 @@ Set it to t or to a list of major modes."
(setq company-etags-buffer-table (company-etags-find-table))
company-etags-buffer-table)))
-(defun company-etags--candidates (prefix)
+(defun company-etags--candidates (prefix suffix)
(let ((tags-table-list (company-etags-buffer-table))
(tags-file-name tags-file-name)
- (completion-ignore-case company-etags-ignore-case))
+ (completion-ignore-case company-etags-ignore-case)
+ (completion-styles (if (listp company-etags-completion-styles)
+ company-etags-completion-styles
+ completion-styles))
+ table)
(and (or tags-file-name tags-table-list)
(fboundp 'tags-completion-table)
- (save-excursion
- (visit-tags-table-buffer)
- (all-completions prefix (tags-completion-table))))))
+ (setq table
+ (save-excursion
+ (visit-tags-table-buffer)
+ (tags-completion-table)))
+ (if company-etags-completion-styles
+ (let ((res (company--capf-completions prefix suffix table)))
+ (setq company-etags--boundaries (assoc-default :boundaries res))
+ (assoc-default :completions res))
+ (all-completions prefix table)))))
;;;###autoload
-(defun company-etags (command &optional arg &rest _ignored)
+(defun company-etags (command &optional arg &rest rest)
"`company-mode' completion backend for etags."
(interactive (list 'interactive))
(cl-case command
@@ -95,8 +112,11 @@ Set it to t or to a list of major modes."
(cl-some #'derived-mode-p company-etags-everywhere)
(not (company-in-string-or-comment)))
(company-etags-buffer-table)
- (or (company-grab-symbol) 'stop)))
- (candidates (company-etags--candidates arg))
+ (company-grab-symbol-parts)))
+ (candidates (company-etags--candidates arg (car rest)))
+ (adjust-boundaries (and company-etags-completion-styles
+ company-etags--boundaries))
+ (no-cache company-etags-completion-styles)
(location (let ((tags-table-list (company-etags-buffer-table)))
(when (fboundp 'find-tag-noselect)
(save-excursion
- [elpa] externals/company 2fefdc7ce3 02/30: Fix test failures, (continued)
- [elpa] externals/company 2fefdc7ce3 02/30: Fix test failures, ELPA Syncer, 2024/07/13
- [elpa] externals/company 436b0d6247 10/30: New backend command `adjust-boundaries`, ELPA Syncer, 2024/07/13
- [elpa] externals/company 477799b362 18/30: Make suffix matching use "proper suffix" logic by default, ELPA Syncer, 2024/07/13
- [elpa] externals/company a011dbd892 27/30: Update company-files tests, ELPA Syncer, 2024/07/13
- [elpa] externals/company 277640481a 19/30: Render the "preview" overlay over the matching suffix text, ELPA Syncer, 2024/07/13
- [elpa] externals/company 54b0148ce4 16/30: Fix bytecomp warnings, ELPA Syncer, 2024/07/13
- [elpa] externals/company d4e01ed948 21/30: #1474 change the reference in NEWS, ELPA Syncer, 2024/07/13
- [elpa] externals/company 31f7ad52e4 30/30: Merge pull request #1474 from company-mode/completion_inside_symbol, ELPA Syncer, 2024/07/13
- [elpa] externals/company a253fa5505 25/30: company-files--prefix: Capture suffix as well, ELPA Syncer, 2024/07/13
- [elpa] externals/company bbe0bc031a 13/30: company--multi-backend-adapter: Support suffix and `adjust-boundaries`, ELPA Syncer, 2024/07/13
- [elpa] externals/company c8a06ff3bf 11/30: Support completion styles in company-etags too,
ELPA Syncer <=
- [elpa] externals/company a986091380 20/30: Fix test failures, ELPA Syncer, 2024/07/13
- [elpa] externals/company 0503adea94 22/30: company-dabbrev: Also support completion inside a word, ELPA Syncer, 2024/07/13
- [elpa] externals/company 6f54897015 15/30: Fix remaining failure, ELPA Syncer, 2024/07/13
- [elpa] externals/company c987a27148 24/30: company-files: Use the `adjust-boundaries` action, ELPA Syncer, 2024/07/13
- [elpa] externals/company bc52a6136e 17/30: Strip the matching suffix in preview too, ELPA Syncer, 2024/07/13
- [elpa] externals/company ec587719e3 12/30: company-etags: CAPF match highlighting, ELPA Syncer, 2024/07/13
- [elpa] externals/company 92ebedd921 28/30: Better summary, fixed url, ELPA Syncer, 2024/07/13
- [elpa] externals/company 21bfd9cbc7 29/30: Fix "sneaky refresh" when boundaries are used, ELPA Syncer, 2024/07/13
- [elpa] externals/company 0de16299dc 26/30: Make sure to redraw popup when boundaries change, ELPA Syncer, 2024/07/13