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
[notebook] deduplicate completion results #1841
Conversation
remove context completion that are duplicates from introspection completion fixes ipython#1840
made a mistake, close, will reopen. |
@fperez , this should remove the "duplicates" completions by favoring introspection completion from context completion. There might (really not sure) be some false positive of 'duplicates', so some context completion might not show up in rare case, but no completion coming from live object introspection will be discarded. |
The functionality seems to work correctly, thanks! I only have a couple of comments:
but in general I see our JS files use the more traditional placing of the opening brace in the same line:
so it should probably conform to that.
thus ensuring uniqueness, rather than doing all the per-item check you are doing. But again, I don't know much JS, so perhaps there's no cleaner way to do it. @ellisonbg, @minrk, thoughts on this one? |
There doesn't seem to be something like http://stackoverflow.com/questions/4833651/javascript-array-sort-and-unique |
Well, issue is that both introspection and context completion does not return the same thing. And as the 2 keys are different I have the deduplication try to match only the ends of the strings, but only when one of them start with a dot, because obviously, you don't want to find that Still I'll see If I can shorten the logic. As for the brace, i'll never get used to it, will fix it. |
Great, thanks. Ping us when you've updated the logic and we'll revisit, I'd really like to see this merged. |
Well, I tried, there is one check that I can omit, but I don't see how I can deduplicate faster. Sorting does not help, uniqueness is not well enough related to comparing items. assuming I want
Which is already sorted. and obviously the duplicates are not next to each other... so you can't test for equality, or use hash, set .... If you have any more ideas ... or i'm good to go |
I think this can go in as is. |
I'm OK too if there's no better option, I just wanted to look into it. Thanks for taking the time to investigate, @Carreau. I'm merging now b/c this bug is really annoying me. |
[notebook] deduplicate completion results remove context completions that are duplicates from introspection completion fixes #1840
[notebook] deduplicate completion results remove context completions that are duplicates from introspection completion fixes ipython#1840
remove context completion that are duplicates from introspection
completion
fixes #1840