Skip to content

fix: fuzzy autocompletion with blink #1010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

seflue
Copy link
Contributor

@seflue seflue commented Jul 6, 2025

Summary

This PR fixes fuzzy matching for blink.cmp in orgmode completion. Previously blink.cmp only did prefix matching like nvim-cmp, now it
actually uses its fuzzy matcher.

Related Issues

Related #977

Changes

  • Let blink.cmp get all completion results instead of pre-filtering them
  • Added filterText field so blink.cmp knows what to fuzzy match against
  • Fixed base extraction to not break completion context

Checklist

I confirm that I have:

  • Followed the
    Conventional Commits
    specification
    (e.g., feat: add new feature, fix: correct bug,
    docs: update documentation).
  • My PR title also follows the conventional commits specification.
  • Updated relevant documentation, if necessary.
  • Thoroughly tested my changes.
  • Added tests (if applicable) and verified existing tests pass with
    make test.
  • Checked for breaking changes and documented them, if any.

@seflue seflue force-pushed the fix/fuzzy-autocompletion-with-blink branch from 9504c22 to 4cad01e Compare July 26, 2025 12:18
@seflue seflue force-pushed the fix/fuzzy-autocompletion-with-blink branch from 4cad01e to 1403ced Compare August 9, 2025 12:26
@seflue
Copy link
Contributor Author

seflue commented Aug 9, 2025

@kristijanhusak The PR is open quite a while. Any feedback what is preventing the merge? The failing test is unrealted to the code. I just rebased it onto the latest master.

Copy link
Member

@kristijanhusak kristijanhusak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay. I didn't get a chance to do a proper review and testing.
This does solve some of the issues with the fuzzy matching, but it introduces some other bugs. For example, autocompletion by headline/custom id after the file name stopped working:

[[file:/path/to/org/todos.org::*My headline

This simplified base is a bit hacky tbh. Can we figure out a solution where the fuzzy matching would work for all the sources? For example, add fuzzy = true/false to the org.completion.complete function in a same way that you added framework, and set true from cmp/blink, and for omni, check if &competeopt has it.
Then, if it's true, use matchfuzzy to match the values, otherwise do the substring as it is now.
What do you think?

@kristijanhusak
Copy link
Member

Unfortunately it's not that simple. The substring matching goes all the way down to the sources. It needs to be refactored so the context can be passed down, and internal sources can rely on the context value. I'll see if I can figure out something out at least for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants