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

Current way of displaying cheatsheet is inconvenient #3678

Closed
katomuso opened this issue May 24, 2024 · 3 comments
Closed

Current way of displaying cheatsheet is inconvenient #3678

katomuso opened this issue May 24, 2024 · 3 comments

Comments

@katomuso
Copy link
Contributor

Initially, cheatsheet was designed to display the entire hierarchy in a single Helm buffer (as seen in the screenshot at https://github.com/clojure-emacs/clojure-cheatsheet), allowing the user to search through the entire cheatsheet at once. However, the current implementation using completing-read requires us to navigate one level of the hierarchy at a time. This is much less convenient because we need to know where the item we are looking for is located, and even if we do know, it takes additional steps to do so.

Instead of having multiple completions for each level of the hierarchy, we can represent the hierarchy in a flat view, so a single line will display the full path to an item, with the path elements separated by a specific separator. For example, lines might look like Collections > Maps > Change > clojure.core/assoc with > as the separator. Using a fuzzy completion style (such as the one provided by the orderless.el package), we will be able to search for any element within the path, potentially displaying matches from multiple sections at the same time, which is especially convenient when displaying completions vertically (for example, with the vertico.el package).

This can be implemented by transforming the hierarchy into an appropriate flat format that will be displayed using completing-read. When the user selects a line, we split it by the separator and get the last item, which is the symbol. Then, we show the documentation for it as usual. I can do this, but I'm not sure if it's better to implement it as a separate function that can be called alternatively to cider-cheatsheet (something like cider-cheatsheet-flat) or to alternate the behavior of cider-cheatsheet when a prefix argument is passed.

@johngit22
Copy link

johngit22 commented May 25, 2024 via email

@bbatsov
Copy link
Member

bbatsov commented May 25, 2024

Instead of having multiple completions for each level of the hierarchy, we can represent the hierarchy in a flat view, so a single line will display the full path to an item, with the path elements separated by a specific separator. For example, lines might look like Collections > Maps > Change > clojure.core/assoc with > as the separator. Using a fuzzy completion style (such as the one provided by the orderless.el package), we will be able to search for any element within the path, potentially displaying matches from multiple sections at the same time, which is especially convenient when displaying completions vertically (for example, with the vertico.el package).

I'd be fine with this. It's true that the current UI is a bit clunky with the separate section selection step.

@katomuso
Copy link
Contributor Author

katomuso commented May 25, 2024

Good! I have some preliminary work done, now I just need to think about how to best implement it from a user interaction perspective.

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

No branches or pull requests

3 participants