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(sessions): Suggestion for a similar session name #843

Merged
merged 1 commit into from
Nov 11, 2021
Merged

feat(sessions): Suggestion for a similar session name #843

merged 1 commit into from
Nov 11, 2021

Conversation

ken-matsui
Copy link
Contributor

@ken-matsui ken-matsui commented Nov 8, 2021

I implemented a suggestion for a similar session name if the provided name does not exist.

If an invalid session name is provided, attach and kill session commands output errors:

$ zellij k scientific-activ
No session named "scientific-activ" found.

$ zellij a scientific-activ
No session named "scientific-activ" found.

This PR adds help to this using Levenshtein distance as the same with rustc implementation:

No session named "scientific-activ" found.
  help: Did you mean `scientific-activity`?

@a-kenji a-kenji requested a review from imsnif November 9, 2021 08:12
@a-kenji
Copy link
Contributor

a-kenji commented Nov 9, 2021

@ken-matsui,
This is an awesome feature!
Thanks for taking the time in making this pr.
I would like to have someone else take a look at the crate that is being added.
cc @imsnif

@imsnif
Copy link
Member

imsnif commented Nov 9, 2021

Hey, I'd be happy to look but just a heads up: I have a very busy week so if you need my review on this it might have to wait for next one.

@a-kenji
Copy link
Contributor

a-kenji commented Nov 9, 2021

@imsnif,
Thanks for the heads up - that is of course totally fine.
Also this feature should be easy to be merged anyway.

@ken-matsui
Copy link
Contributor Author

@a-kenji
Thank you. I replaced the crate I've added with a smaller one.

@a-kenji
Copy link
Contributor

a-kenji commented Nov 10, 2021

Awesome!
Thanks for creating this crate just for this case,
it is now much easier to understand.

Remove unnecessary to_string

Replace `garando_syntax` crate with `lev_distance` which is much smaller

Replace `lev_distance` crate with `suggestion` to simplify the code
@ken-matsui
Copy link
Contributor Author

@a-kenji
Sorry to bother you! I newly re-replaced the crate.
This PR is ready to merge :)

@a-kenji a-kenji merged commit be692fd into zellij-org:main Nov 11, 2021
@a-kenji
Copy link
Contributor

a-kenji commented Nov 11, 2021

Awesome, thanks! This is cool functionality.
Also nice 2 crates.

@ken-matsui ken-matsui deleted the suggestion-for-similar-session-name branch November 12, 2021 00:33
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.

3 participants