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: improve help #2712

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

DeH4er
Copy link
Contributor

@DeH4er DeH4er commented Mar 15, 2024

Linking discussion #2710

This is roughly what the help panel looks like. I didn't add all apis and I'd need some help here since I'm not aware of some functionality.

Screenshot 2024-03-15 at 21 42 59

It shouldn't change drastically how users write on_attach. The only thing is that they don't need to pass eg. nvim-tree: Open in opts and it'll catch up if they use api.x.y function. If they pass a custom function as a keybinding, currently it'll not be displayed in help panel

@alex-courtis
Copy link
Member

This is looking good - the layout is logical and discoverable.

I'm assuming that this will be another s mode, as we don't want to break users that expect the current layout. We can, however, add the actual api functions to the existing s modes.

@alex-courtis
Copy link
Member

The groupings are almost broken up as per the 10 API groups: tree, fs, marks etc.

In the interest of simplicity and maintainability we should use those groupings, being consistent with help etc.

That feeds into the next comment.

@alex-courtis
Copy link
Member

There is too much boilerplate code configuration here and it's not going to be very maintainable. We were in such a place before we completely moved to on_attach and it caused difficulties.

Rather than using boilerplate we can be lazy and do something like walking the Api tree. We can generate strings like validate_options does and map the functions themselves to the vim mappings. We could create a small table that maps Api.xxx to a human readable header.

Goals:

  • no change to api.lua
  • no change to keymap.lua
  • default and user on_attach still look and function the same
  • help and all its generation remains unchanged

I reckon this change would only need to hit help.lua and utils.lua for all the desired functionality and would maintain itself.

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.

None yet

2 participants