Skip to content
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

Smarter matching: when typed chars are exactly matched against entries, put them first #4

Closed
zjp-CN opened this issue Apr 6, 2024 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@zjp-CN
Copy link
Owner

zjp-CN commented Apr 6, 2024

Current:

截图_20240406100518

Wanted: Period first

@zjp-CN zjp-CN added the enhancement New feature or request label Apr 6, 2024
@zjp-CN
Copy link
Owner Author

zjp-CN commented Apr 6, 2024

As of zjp-CN/nvim-config@e31b935 , put score comparator first can solve this.

local compare = require("cmp").config.compare

opts.sorting.comparators = {
        compare.score, -- add this
        comparators.inscope_inherent_import,
        comparators.sort_by_label_but_underscore_last,
}

截图_20240406102335

Documention should be improved.

@zjp-CN zjp-CN added documentation Improvements or additions to documentation and removed enhancement New feature or request labels Apr 6, 2024
@zjp-CN
Copy link
Owner Author

zjp-CN commented Apr 7, 2024

截图_20240407123816

local compare = require("cmp").config.compare

opts.sorting.comparators = {
    compare.exact, -- add this
    compare.score,
    comparators.inscope_inherent_import,
    comparators.sort_by_label_but_underscore_last,
}

截图_20240407124104

@zjp-CN
Copy link
Owner Author

zjp-CN commented Apr 25, 2024

Documentation supplement done in d9ebeca .

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

No branches or pull requests

1 participant