branch: externals/company commit f6c1655dc49551a159f8aa040834905851b7809a Author: YugaEgo <y...@ego.team> Commit: YugaEgo <y...@ego.team>
Fix company-files-exclusions docstring and application --- company-files.el | 6 +++--- test/files-tests.el | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/company-files.el b/company-files.el index 902ea5e..69d6793 100644 --- a/company-files.el +++ b/company-files.el @@ -33,9 +33,9 @@ :group 'company) (defcustom company-files-exclusions nil - "File name extensions and directory names to ignore. + "A list of file name extensions and directory names to ignore. The values should use the same format as `completion-ignored-extensions'." - :type '(const string) + :type '(repeat (string :tag "File extension or directory name")) :package-version '(company . "0.9.1")) (defcustom company-files-chop-trailing-slash t @@ -59,7 +59,7 @@ Set this to nil to disable that behavior." (file-error nil))) (defun company-files--exclusions-filtered (completions) - (let* ((dir-exclusions (cl-delete-if-not #'company-files--trailing-slash-p + (let* ((dir-exclusions (cl-remove-if-not #'company-files--trailing-slash-p company-files-exclusions)) (file-exclusions (cl-set-difference company-files-exclusions dir-exclusions))) diff --git a/test/files-tests.el b/test/files-tests.el index b5dd484..095f4b7 100644 --- a/test/files-tests.el +++ b/test/files-tests.el @@ -46,3 +46,12 @@ (should-not (member (expand-file-name "company.el" company-dir) (company-files 'candidates company-dir))))) + +(ert-deftest company-files-candidates-excluding-dir-and-files () + (let* ((company-files-exclusions '("test/" ".el")) + company-files--completion-cache + (files-candidates (company-files 'candidates company-dir))) + (should-not (member (expand-file-name "test/" company-dir) + files-candidates)) + (should-not (member (expand-file-name "company.el" company-dir) + files-candidates))))