minad / corfu

:desert_island: corfu.el - COmpletion in Region FUnction
GNU General Public License v3.0
1.15k stars 43 forks source link

Not getting highlighting with anything other than elisp #346

Closed sethen closed 1 year ago

sethen commented 1 year ago

Hello!

Love the package. However I am having trouble getting highlighting to work on my matches when candidates come up with everything besides elisp. For instance, whenever I type in elisp I get highlighted matches like so: Screenshot from 2023-07-08 15-55-00

But whenever I type something in a JavaScript file I do not get the highlighted matches: Screenshot from 2023-07-08 15-55-36

I am using orderless and not sure if that has anything to do with it. Here is my current configuration for corfu:

(require 'use-package)

(use-package corfu
  :config
  (setq corfu-auto t
        corfu-auto-delay 0
        corfu-auto-prefix 0)
  :custom
  (corfu-preselect 'prompt)
  :init
  (corfu-popupinfo-mode)
  (global-corfu-mode))

(provide 'sethen-corfu)

Might be a dumb question but I am coming from company where the matches were always highlighted. For what it's worth I am using emacs lsp which also might have something to do with this?

minad commented 1 year ago

Hi! It depends on the lsp client. Eglot uses the flex completion style for highlighting and lsp-mode completely disables completion style filtering (including highlighting) by overriding the completion style setting with a special lsp-passthrough style. Lsp-mode uses the company-match Company extension to provide highlighting, which I do not intent to support in Corfu. You can still enforce that Orderless (or some other style) is used for filtering, see https://github.com/minad/corfu/wiki#configuring-corfu-for-lsp-clients.