Skip to content

Possibly use flx-make-filename-cache rather than flx-make-string-cache #2816

@marcsaegesser

Description

@marcsaegesser

I'm coming to ivy from flx-ido and found that filename matching was very different and less useful. I finally discovered the reason for the difference. When calling flx-score, flx-ido uses flx-file-cache, which is a filename cache defined in flx-ido.el. In ivy, the call to flx-score uses ivy--flx-cache which is a string cache defined in ivy.el. The difference in behavior is pretty big. Changing ivy--flx-cache to a filename cache would probably be too disruptive to people already familiar with the existing behavior. Maybe it would be possible add an official way to switch to using a filename cache rather than a string cache? In my current configuration I include (setq ivy--flx-cache (flx-make-filename-cache)) after ivy is loaded and the flex matching now works like I'm used to.

Here's an example of how matching is different. I have an sbt project with a source named something like "src/main/scala/org/fu/MySuperApp.scala". With a query of "ms" the string cache settles on the 'm' in main and the 's' in scala so all of my source code ends up with the same flx-score. The filename cache selects the 'M' and 'S' in the file name, which is a much more useful result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSuggestion to improve or extend existing behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions