PythonNut / company-flx

:city_sunset: Flx fuzzy matching for company
GNU General Public License v3.0
85 stars 6 forks source link

match the exactly candidate first #14

Closed futurist closed 7 years ago

futurist commented 8 years ago

When input kbd now the candidate popup is:

key-binding
kbd
........

In this case, should it the kbd as first candidate?

similar case, when input setq

select-tags-table-quit
setq
PythonNut commented 8 years ago

That's strange because, as far as I know, exact matches should always get priority. Let me look into it.

PythonNut commented 8 years ago

@futurist For me, kbd matches kbd first. Are you sure something isn't interfering with your sorting?

futurist commented 8 years ago

below is my config with company-flx:


(require-package 'company)
(require-package 'company-flx)
(require-package 'company-tern)
(require-package 'company-quickhelp)
(add-hook 'after-init-hook 'global-company-mode)
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 2)
(after-load 'company
  (company-flx-mode +1)
  (setq company-auto-complete t)
  (setq company-flx-limit 15)
  (define-key company-active-map (kbd "<SPC>") '(lambda()(interactive) (company-abort) (insert " ")))
  (define-key company-active-map (kbd "C-j") 'company-abort)
  (define-key company-active-map (kbd "<tab>") 'company-complete-common-or-cycle)
  (define-key company-active-map "\C-n" 'company-select-next-or-abort)
  (define-key company-active-map "\C-p" 'company-select-previous-or-abort)
  )
(after-load 'company-tern
  (add-to-list 'company-backends 'company-tern)
  )
futurist commented 8 years ago

I think the problem maybe is the (setq company-minimum-prefix-length 2) kb will trigger company first, then with third key d, the sort order don't changed.

PythonNut commented 8 years ago

I think the problem maybe is the (setq company-minimum-prefix-length 2)

I don't think so because I also use that setting. I'll take a look today, if I get the chance.

PythonNut commented 7 years ago

To confirm, I still can't reproduce.