-
Notifications
You must be signed in to change notification settings - Fork 7
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
upstream to :help lua-guide #5
Comments
Thanks for the nice words 😄 I'd be more than happy to. |
@justinmk would you like me to open a PR to Neovim? |
yes! here's a rough idea: Note: historically the discussion about include these
skip these for now (to unblock the PR / avoid controversy)
|
This comment was marked as duplicate.
This comment was marked as duplicate.
I don't think suggesting to prefer one umbrella command to several targeted commands is an enough universal advice to be included in core. To me this is a more question of taste. "Pollute the command namespace" is obviously a bad thing if formulated this way, while "provide more narrowly scoped commands" is not .
I don't think suggesting to create a And "If a user has to call a
Do not agree at all that this is worded as to "leave the door open for judgement". The "Automatically initialize your plugin (smartly), with minimal impact on startup time." might sound good on paper, yet:
Having
"Don't use 0ver" suggestion is a bit ironic to be included in Neovim itself and is not a universally good advice. Many successful projects work just fine with 0ver. |
@echasnovski thanks for the input. It's definitely great to get
Just to be clear, I don't advocate for a single command with subcommands per plugin.
It's definitely not universal advice, and depends on the use case.
Could you please elaborate on this? Being able to enforce things like Sure, these are not always needed, which is why I also have a DO section
A bit of overhead can be a massive time saver if it results in less time wasted
If it weren't forced on the user, I would agree.
This seems like a slippery slope argument. I don't see how these steps are necessarily connected.
That perspective is highly subjective and likely influenced by the status quo. In fact, the only 'complaint' I've ever heard about one of my plugins not providing a
Bad practices tend to be easier to grasp.
I fully agree with this. Although personally, I do believe "SemVer to properly communicate bug fixes, new features, and breaking changes." is the best approach, and it would be beneficial if it were consistent across the ecosystem. |
This looks like violating the advice as it is written, because it should instead be
Forcing mapping options is the sole benefit here, yes. "Expose functionality for specific modes" and "Expose different behaviour for different modes with a single
Suggesting instead to force on the user to create mappings themselves does not look like a clear advantage in this aspect.
As not everyone prefers things to be forcefully executed. Separate files for keymaps, highlight groups, and other configurations are certainly possible with "single entry point
As is bad advice. If anything, my main issues with most of the suggestions here can probably be summarized as:
|
I don't want this to be blocked on nitpicks or concerns about style. Plugin authors need a place to start, and in all of the discussion above I don't see any concrete "bad advice". Style preferences are not "bad advice", and plugin authors can choose to diverge if they want. But we need to give a starting point. |
Having "don't do this approach" with this exact wording inside core help is a bit more than "it is just a style preferences". Modifying the text to contain only "do"s and mentioning other approaches without shedding bad light will go a long way. |
@echasnovski In case of misunderstanding: My response aimed to clarify that being easy to grasp does not necessarily equate to "good practice." Your response did not address the substance of my point and seemed more focused This approach is counterproductive and detracts from a respectful and meaningful exchange. If we cannot keep this discussion civil and focused on the topic, To address your other concerns:
This seems like a misinterpretation of the advice on your part.
Yes, that is possible, but it would involve adding side effects
We're discussing
This is another straw man. I never advocated for things to be forcefully executed.
Some plugin managers provide abstractions for doing this.
Vimscript, too, has first class support in Neovim.
My document does not make any recommendations to use
I have yet to be presented with evidence that a single
I agree that some of the DON'Ts could probably be excluded from core. But some of the DON'Ts (e.g. don't create keymaps automatically) are quite uncontroversial, |
@mrcjk, in case of misunderstanding: no confrontation was intended. My response aimed to clarify that being easy to grasp should be one of the main goals of built-in help for creating Lua plugins, while avoiding bad advice at the same time. |
agree with @echasnovski , I do not think the sub command section and version release section should be merged into neovim main doc. there should be a guide to avoid user to write wrong code, for example, create autocmd without augroup. It maybe broken when other plugin override the autocmd. All roads lead to Rome |
@wsdjeg see my response to your other comment in the neovim PR.
Agreed. It's that a common footgun? Although maybe that should be (or is?) included in the respective autocommand docs? |
Your notes here are quite good. Would you be willing to upstream (most of) it to
:help lua-guide:help lua-plugin
(in a newlua-plugin.txt
help file)? This would allow us to close neovim/neovim#22366Some of the controversial parts could be skipped for now, but 85% of what you have would give a great starting point for
:help lua-plugin
.The text was updated successfully, but these errors were encountered: