Only register adapters for each feature when enable = true #46

Closed
opened 2026-04-06 15:34:38 +00:00 by llakala · 3 comments
llakala commented 2026-04-06 15:34:38 +00:00

All the adapters are registered nonlazily here:
github.com/barrettruth/canola-collection@65aa1c4f72/plugin/canola-collection.lua (L6-L14)
The five calls of register_adapter result in a startup performance penalty of ~14ms on my machine. This is pretty small, but it makes canola-collection a relatively heavy plugin for me, which I think can be avoided.

Instead of always registering an adapter, an enable field could be added to each of the canola-collection config tables. There's already one for canola-git, just not the others. This would lower the startup penalty for most users, who likely just want trash or git support.

All the adapters are registered nonlazily here: https://github.com/barrettruth/canola-collection/blob/65aa1c4f72857d749a00a266d0cfd8e7178cbec2/plugin/canola-collection.lua#L6-L14 The five calls of `register_adapter` result in a startup performance penalty of ~14ms on my machine. This is pretty small, but it makes canola-collection a relatively heavy plugin for me, which I think can be avoided. Instead of always registering an adapter, an `enable` field could be added to each of the canola-collection config tables. There's already one for `canola-git`, just not the others. This would lower the startup penalty for most users, who likely just want trash or git support.
barrettruth commented 2026-04-20 15:05:05 +00:00

just saw this. addressing today.

just saw this. addressing today.
barrettruth commented 2026-04-20 20:16:56 +00:00

The extensions are now conditionally enabled based on the existence of the config variable ({} is truthy). vim.g.canola_git.enabled has been removed.

If you do not want the plugin enabled, then don't set the corresponding vim.g.canola_<extension>.

Secondly, I'm removing vim.g.canola.delete.trash in favor of vim.g.canola_trash. Honestly, no idea why I even did that... smh. It'll be done in the next 10 minutes

In other words, I'm pretty sure that you use trash - update your config!

Sorry for these breaking changes - however, I'm taking advantage of them while I have them (before general release) ;)

The extensions are now conditionally enabled based on the existence of the config variable (`{}` is truthy). `vim.g.canola_git.enabled` has been removed. If you do not want the plugin enabled, then don't set the corresponding `vim.g.canola_<extension>`. Secondly, I'm removing `vim.g.canola.delete.trash` in favor of `vim.g.canola_trash`. Honestly, no idea why I even did that... smh. It'll be done in the next 10 minutes ***In other words, I'm pretty sure that you use trash - update your config!*** Sorry for these breaking changes - however, I'm taking advantage of them while I have them (before general release) ;)
llakala commented 2026-04-21 04:47:18 +00:00

No worries - happy to find issues before others would. Can confirm that register_adapter is now only being called once in my logs, and trash support is working well with the truthy {}.

No worries - happy to find issues before others would. Can confirm that `register_adapter` is now only being called once in my logs, and trash support is working well with the truthy `{}`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
barrettruth/canola-collection#46
No description provided.