Skip to content

Commit

Permalink
Respect backend prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Feb 7, 2022
1 parent d3714c7 commit a004ae1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions company-fuzzy.el
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ For instance, if there is a candidate function `buffer-file-name' and with
current prefix `bfn'. It will just return `bfn' because the current prefix
does best describe the for this candidate."
(cl-case backend
(`company-capf (thing-at-point 'symbol))
(`company-capf (company-capf 'prefix))

This comment has been minimized.

Copy link
@jcs090218

jcs090218 Feb 8, 2022

Author Member

Calling (company-capf 'prefix) is 45 times faster than thing-at-point.

(`company-files
;; NOTE: For `company-files', we will return the last section of the path
;; for the best match.
Expand All @@ -495,7 +495,7 @@ does best describe the for this candidate."
(len-splitted (length splitted))
(last (nth (1- len-splitted) splitted)))
last))
(`company-yasnippet (thing-at-point 'symbol))
(`company-yasnippet (company-yasnippet 'prefix))
(t company-fuzzy--prefix)))

(defun company-fuzzy--backend-prefix-get (backend)
Expand All @@ -522,7 +522,7 @@ P.S. Not all backend work this way."
(setq new-prefix
(substring prefix 0 (- (length prefix) (length last)))))
new-prefix))))
(`company-yasnippet "")
(`company-yasnippet (company-yasnippet 'prefix))
(t (ignore-errors (substring company-fuzzy--prefix 0 1)))))

(defun company-fuzzy--backend-prefix (backend type)
Expand Down

0 comments on commit a004ae1

Please sign in to comment.