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

feat(vscode): support autocomplete with fuzzy search. #2769

Merged
merged 7 commits into from Jun 23, 2023

Conversation

chizukicn
Copy link
Contributor

Features:

1. Support autocomplete with fuzzy search.

Just like Windicss Intellisense

2023-06-16.11.32.40.mov

this feature need set match type to be 'fuzzy'

image

2. Add autocomplete max items configure.

image

For better performance during fuzzy search, we need add a setting for the maximum number of items

@chizukicn chizukicn requested a review from antfu as a code owner June 16, 2023 06:44
@netlify
Copy link

netlify bot commented Jun 16, 2023

Deploy Preview for unocss ready!

Name Link
🔨 Latest commit 21fe2a5
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/649574947fd4e9000855a777
😎 Deploy Preview https://deploy-preview-2769--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

* @returns
*/
export function searchFuzzy(list: string[], keyword: string) {
const regex = new RegExp(keyword.split('').join('.*'))
Copy link
Member

Choose a reason for hiding this comment

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

Creating a new regex for every change does not sound very efficient to me. Can we use fzf or Fuse.js to do it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice! Fzf can dot it better.

@chizukicn chizukicn requested a review from antfu June 23, 2023 03:48
@antfu
Copy link
Member

antfu commented Jun 23, 2023

Look good! We could have it for now, and later if we make the ordering handles better, we could enable it by default.

For example, this should list gap- first
image

@antfu antfu enabled auto-merge (squash) June 23, 2023 10:33
@antfu antfu merged commit f611dca into unocss:main Jun 23, 2023
10 checks passed
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.

None yet

3 participants