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

Closed
opened 2026-09-21 17:53:38 +00:00 by barrettruth · 3 comments
Owner

Original issue: barrettruth/canola-collection#46
Original author: llakala
Original date: 2026-04-06T15:34:38Z

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.

> Original issue: barrettruth/canola-collection#46 > Original author: `llakala` > Original date: 2026-04-06T15:34:38Z 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.
Author
Owner

Original comment: barrettruth/canola-collection#46, comment 4281963735
Original author: barrettruth
Original date: 2026-04-20T15:05:05Z

just saw this. addressing today.

> Original comment: barrettruth/canola-collection#46, comment 4281963735 > Original author: `barrettruth` > Original date: 2026-04-20T15:05:05Z just saw this. addressing today.
Author
Owner

Original comment: barrettruth/canola-collection#46, comment 4283996020
Original author: barrettruth
Original date: 2026-04-20T20:16:56Z

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) ;)

> Original comment: barrettruth/canola-collection#46, comment 4283996020 > Original author: `barrettruth` > Original date: 2026-04-20T20:16:56Z 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) ;)
Author
Owner

Original comment: barrettruth/canola-collection#46, comment 4285983050
Original author: llakala
Original date: 2026-04-21T04:47:18Z

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 {}.

> Original comment: barrettruth/canola-collection#46, comment 4285983050 > Original author: `llakala` > Original date: 2026-04-21T04:47:18Z 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 description provided.