Giter Site home page Giter Site logo

Comments (5)

oantolin avatar oantolin commented on July 1, 2024 1

So, from reading company's source, it seems it only supports using one face for highlighting matches. A company backend can provide a match operation that computes a list of intervals to highlight and they always get highlighted with the company-echo-common face.

Now, how does company wind up using completions-common-part then? Well, company comes with a company-capf backend that uses the standard capf (completion at point functions) API, capf in turn uses completion styles. The company-capf backend's implementation of match goes through the candidates and searches for the completions-common-part face, and returns those intervals. At some point later company applies company-echo-common to those intervals.

In other words, you can't get easily get company to whatever the faces the completion style wants: company-capf will take of note of where it finds completions-common-part and then in a separate step apply to those intervals the only face it uses to highlight matches, company-echo-common.

So I think if people want more faces in company, company needs to change (for example, the match operations could be generalized: instead of just returning a list of intervals, it could be allowed to return a list of intervals with faces for each). Maybe it's reasonable to propose that over at company.

In the meantime, if you are satisfied with highlighting all matching portions with the same face, you can use this:

(defun orderless--use-completions-common-part (fn &rest args)
  (let ((orderless-match-faces [completions-common-part]))
    (apply fn args)))

(advice-add 'company-capf--candidates
            :around #'orderless--use-completions-common-part)

I think I'll add this to the README in a new "integration with company" section.

from orderless.

oantolin avatar oantolin commented on July 1, 2024

Oh. I'll read the flex source code to se how they do it.

from orderless.

oantolin avatar oantolin commented on July 1, 2024

Mmh. It looks like company is specifically looking for the face completions-common-part... :( (And changing orderless to use only that face does make the highlighting appear in company.)

I'll think about detecting use through company and in that case using only that face. But maybe company should actually allow more than one face for higlighting matches.

from orderless.

oantolin avatar oantolin commented on July 1, 2024

I've added a section to the README on Company integration now. I think that's really all that can be done on this end for the highlighting. Maybe we can close this issue.

from orderless.

noctuid avatar noctuid commented on July 1, 2024

Okay, I opened an issue on the company repo. Thanks for the workaround.

from orderless.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.