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

fix: avoiding duplicate candidates in the which component #975

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

mikavilpas
Copy link
Contributor

Fixes #955

Also added a test for this bug as a suggestion.

Let me know how you would prefer testing to be done in this project!

@sxyazi
Copy link
Owner

sxyazi commented Apr 29, 2024

Thanks for the PR!

I don't think this test is necessary because KEYMAP.init can only be called once, and it's difficult to assume whether it will appear in other tests.

It contains unsafe code, so currently, it's restricted to only being used in the init method of each crate (like this

pub fn init() {
) and I don't want to spread unsafe code into tests, so could you remove the test and only modify the minimum code?

@mikavilpas mikavilpas force-pushed the fix-duplicate-command-suggestions branch from 7db2354 to b862576 Compare April 29, 2024 14:57
@mikavilpas
Copy link
Contributor Author

I think that makes sense. I actually noticed there were issues trying to add another test, probably because the RoCell was already allocated, making for weird errors 😄

The test has now been removed.

@SolitudeSF
Copy link
Contributor

not familiar with the codebase. is it getting deduplicated each time it displays command suggestions?

@mikavilpas
Copy link
Contributor Author

Yes, duplicates are removed every time.

@sxyazi I just noticed this doesn't yet preserve the order of the suggestions, so the suggestions can appear in a random order now. I'll fix this soon.

@mikavilpas mikavilpas marked this pull request as draft April 29, 2024 15:08
@mikavilpas mikavilpas force-pushed the fix-duplicate-command-suggestions branch from b862576 to 0f02b9e Compare April 29, 2024 15:21
@mikavilpas mikavilpas marked this pull request as ready for review April 29, 2024 15:21
@mikavilpas
Copy link
Contributor Author

Ok, order is now preserved 🙂

@sxyazi
Copy link
Owner

sxyazi commented Apr 29, 2024

Thanks!

@sxyazi sxyazi changed the title fix: displaying duplicate command suggestions fix: avoiding duplicate candidates in the which component Apr 29, 2024
@sxyazi sxyazi merged commit 0016876 into sxyazi:main Apr 29, 2024
5 checks passed
@mikavilpas
Copy link
Contributor Author

I like your refactoring, nicely done 👍🏻

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redefining default keybinds in submap displays duplicates
3 participants