-
-
Notifications
You must be signed in to change notification settings - Fork 635
perf(commands): defer module loading #3210
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
perf(commands): defer module loading #3210
Conversation
|
I use my custom, simple Lua module lazy loader. In that way nvim-tree isn't setup and no module is loaded before calling function defined in keymap. It has a drawback: Rarely, but still, I would like to start using nvim-tree with such command. I know that direct call to That |
alex-courtis
left a comment
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.
Normally I'd give dire warnings about lazy loading, predictable ordering and not using API, however you know exactly what you're doing :)
This looks good/safe and won't change anything.
That
setup()logic could exist inplugin/nvim-tree.luainstead.
I'm not quite sure what you mean... would that allow you to avoid requiring commands? Would that not load all the modules?
Either way, sounds good. Do you want to just push it?
| }, | ||
| command = function(c) | ||
| api.tree.open({ path = c.args }) | ||
| require("nvim-tree.api").tree.open({ path = c.args }) |
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.
Initial thought was to use a common function like
local function api()
require("nvim-tree.api")
endhowever that would just obscure things.
The inline require make it really clear what's going on.
Ah, you probably meant pushing plugin approach here 😀 This change seems to be safe to merge separately. Using |
alex-courtis
left a comment
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.
All working, many thanks for your contribution!
No description provided.