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

Case-insensitive and fuzzy match in completion #401

Closed
renkun-ken opened this issue Mar 29, 2021 · 2 comments · Fixed by #405
Closed

Case-insensitive and fuzzy match in completion #401

renkun-ken opened this issue Mar 29, 2021 · 2 comments · Fixed by #405

Comments

@renkun-ken
Copy link
Member

Currently, we use startsWith() to filter completion items. It is fast, but it is case-sensitive and does not allow imprecise matches with the first few characters.

Maybe we should allow some fuzziness and case-insensitivity?

@renkun-ken renkun-ken changed the title Case-insensitive and fuzzy completion Case-insensitive and fuzzy match in completion Mar 29, 2021
@randy3k
Copy link
Member

randy3k commented Mar 30, 2021

I think it makes sense to make some degrees of fuzziness. Do you happen to know an efficient way to do fuzzy matching in R?

Perhaps higher scores for exact matches, followed by case-ignored matches and fuzzy matches.

@renkun-ken
Copy link
Member Author

The easiest is to use built-in agrep() but the completion request is sent by the first few or one character on type, any fuzzy matching will result in too many results. The editor (e.g. vscode) already does some fuzzy matching given a list of completion items.

I tried using grep(ignore.case = TRUE) to filter the result, and it works quite well and there's no notable drop on performance from the experience.

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 a pull request may close this issue.

2 participants