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

2 level documentation popup for :set #5939

Open
goyalyashpal opened this issue Feb 12, 2023 · 4 comments
Open

2 level documentation popup for :set #5939

goyalyashpal opened this issue Feb 12, 2023 · 4 comments
Labels
C-enhancement Category: Improvements

Comments

@goyalyashpal
Copy link
Contributor

In helix 22.12, in the documentation popup for :set key field is shown only for this command.

I am not saying that it should show all the way down to field (3rd level), but it would be really nice if the documentation for the key could also be shown when it is entered.

@askreet
Copy link
Contributor

askreet commented Feb 12, 2023

I think this is a great idea. Started on a possible implementation here. Hope to get back to it soon.

@askreet
Copy link
Contributor

askreet commented Feb 17, 2023

Just leaving some notes here for posterity, I have that branch above that does the easy part but the hard part here is that documentation for options is not embedded into the project. The first hurdle would be, do we want it to be?

I'm generally in favor of this because I like how discoverable Helix is in other areas, with default which-key like behaviors almost everywhere and the auto-help popups, so this feels like a natural extension to me.

Assuming we do want this level of discoverability, there's a few option (and they aren't mutually exclusive to me).

  1. Start building something like help in vim and/or apropo in Emacs. <space>? is good for key->behavior lookups but doesn't add much detail. Being able to type help function_name and get longform prose is the idea here.
  2. Slurp in existing documentation into the binary or runtime directory where it can be looked up. Doc comments are already parsed by rustdoc so it's a matter of putting them somewhere they can be retrieved.
  3. Restructure the way options are stored internally to be more useful to discoverability and validation. At present there's a few things we can't do generically:
    • Show contextual help for an option.
    • Validate whether an option's value is correct. This is done ad-hoc in Validate event handlers, sometimes. Right now if this isn't validated ad-hoc, you get a not super helpful parser error.
    • Suggest option values, particularly if they are an enum (e.g. bufferline).
    • Validate the number of arguments. This is done ad-hoc in Validate event handlers, sometimes.

For #3 one could imagine going in the direction of:

struct HelixOption {
    name: String,
    doc: String,
    type: HelixOptionType,
}

enum HelixOptionType {
    Bool,
    AnyString,
    RegexpString(regexp),
    AnyNumber,
    RangeNumber(range),
}

@goyalyashpal

This comment was marked as resolved.

@rahji
Copy link

rahji commented Aug 11, 2024

Was there a resolution to this? I'd expect :set line-number to show me the possible values (so I don't have to guess - does it take a true/false?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants