-
-
Notifications
You must be signed in to change notification settings - Fork 164
feat: modern menu #549
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: modern menu #549
Conversation
Hey, I don't plan to change the current built in view because it looks similar to Emacs prompt. There are 2 options this can be tackled:
|
230771d
to
9779b29
Compare
I've redone the menu. Now the user can customize the menu himself. |
Hm, I think this opens up a larger question of UI changes and where they belong. Could this (and any UI specifics) be made accessible via the API and enable @danilshvalov and everybody else to write their own UI overhaul of the whole plugin? edit: @danilshvalov don't get me wrong, I really like your take on it :) but I think it might be worthwhile to discuss thinking big here, before we start doing UI customization in the core plugin |
@jgollenz If I understood what was written correctly, right now it is impossible to customize the UI through the API. This PR provides one of the ways of such customization (the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
The general idea is fine, but I don't think there's a need to have presets part of the plugin.
We can either have the default one, or a custom one that the user provides.
Comments on code will explain what's missing.
If you want to expose the modern menu to more people, I would suggest creating a small plugin and just attach it through the config.
Edit: It would also be great to update the documentation with this new option so other users know how to set up a custom menu.
I have redone the code, created some classes that internally check the correctness of the entered data. So now there are two types that can be used in the menu: If everything is fine in the code, I am ready to add documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, you can proceed with docs.
I now thought a little and decided that it would be nice to pass data to the menu not through function arguments, but through a table. For example: Menu.open({
title = 'Some title',
items = { ... },
prompt = 'Prompt',
}) What do you think about it? In the future, with possible expansion, this will make refactoring easier. |
I second this, but please let's document that table somewhere 👍 |
I agree with this. Additionally, I would also expose local menu = Menu:new({
title = 'Some title',
items = { ... }, -- optional
prompt = 'Prompt',
separator = '-',
})
menu:option(label, key, action)
menu:separator(length, char_override)
menu:option(label, key, action)
return menu:open() |
@kristijanhusak This is a great idea! But maybe it would be better to name the methods |
And it's probably better to pass a delimiter to the Menu constructor like this: local menu = Menu:new({
-- ...
separator = {
icon = '~', -- optional, default is `-`
length = 1, -- optional, default is 80
},
}) |
Sure, that also works.
This is also ok. |
I did what we discussed. Review please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just few small changes regarding the arguments.
Ready for review |
I also did a minor refactoring in the default menu. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
Hello everyone I don't really like the way the selection menu is made now. Therefore, I suggest updating it.
Now I have the following developments: