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 match for completion items filtering #15949
base: main
Are you sure you want to change the base?
Conversation
Missing a letter is allowed by matchSumOfSquares so it makes more sense to make filtering case insensitive.
Thanks for making a pull request to jupyterlab! |
Thanks for submitting your first pull request! You are awesome! 🤗 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution @christophediprima.
It certainly does make sense to allow this as a setting. jupyterlab-lsp has a setting for it here. As whatever the default should be - opinions will vary.
Can you try to add the setting and unit tests for completion with this case sensitive and insensitive matchin on and off?
Sure but I am a bit busy right now. I will have a look when I come back from holidays! :) |
@christophediprima did you have a chance to take another look? It seems to have missed to 4.2 merge window, I will switch this PR to draft. |
@@ -390,7 +390,7 @@ export class CompleterModel implements Completer.IModel { | |||
index > -1 | |||
? originalItem.label.substring(0, index) | |||
: originalItem.label; | |||
const match = StringExt.matchSumOfSquares(escapeHTML(text), query); | |||
const match = StringExt.matchSumOfSquares(escapeHTML(text.toLowerCase()), query.toLowerCase()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using toLocaleLowerCase()
instead of toLowerCase()
might be a better call here. It tends to handle language-specific rules more gracefully, which could save us some headaches down the line. Plus, it aligns better with user expectations, especially in multilingual environments. Cheers!
Missing a letter is allowed by matchSumOfSquares so it makes more sense to make filtering case insensitive.