Skip to content
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: lazy-compatible integration with other plugins #215

Open
siimon opened this issue Feb 20, 2024 · 4 comments
Open

feat: lazy-compatible integration with other plugins #215

siimon opened this issue Feb 20, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@siimon
Copy link

siimon commented Feb 20, 2024

Hi and thanks for a wonderful and useful plugin! I just noticed that fidget has now has support for the xcodebuild plugin (which is awesome too, thanks @wojciech-kulik!)

Discovered one issue with this, and it removes the possibility to have the xcodebuild lazy loaded (I use vim for other things than just iOS development, and it feels unnecessary to load xcodebuild at those times). I guess it's because fidget requires xcodebuild during setup?

I'm using lazy.nvim for lazy plugin management!

@j-hui j-hui added the enhancement New feature or request label Feb 20, 2024
@j-hui
Copy link
Owner

j-hui commented Feb 20, 2024

Yeah unfortunately the way integrations are designed, Fidget require()s the xcodebuild plugin to register callbacks.

It might be possible to invert this dependency so that Fidget only sets up callbacks when xcodebuild is needed, but that sounds annoyingly complicated, AKA difficult to maintain, explain, and expand.

@wojciech-kulik and I had already discussed some kind of better integration paradigm starting here---with a filetype-based scheme, we might be able to avoid callbacks altogether. (Since Fidget renders according to a polling loop anyway, it shouldn't need to listen for "window resized" events, it'll just check the filetypes of open windows each time it needs to re-render.)

So I'm tempted to punt this issue until I have the bandwidth to implement filetype-based integrations. But I'm open to hearing your thoughts (and @wojciech-kulik 's!) on this.

@j-hui j-hui changed the title Enabling xcodebuild in fidget removes laziness on xcodebuild feat: lazy-compatible integration with other plugins Feb 20, 2024
@wojciech-kulik
Copy link
Contributor

wojciech-kulik commented Feb 20, 2024

Hmm, what if we could expose some dynamic setup for integrations? For example, the config could stay as it is, but the user would have the possibility to set:

integration = {
   ["xcodebuild-nvim"] = {
       enable = false
   },
}

and then do something like:

require("fidget").integrations.setup("xcodebuild-nvim", { enable = true })

This way the user could decide when to enable it.

@wojciech-kulik
Copy link
Contributor

wojciech-kulik commented Feb 20, 2024

Or alternatively, we could introduce:

integration = {
   ["xcodebuild-nvim"] = {
       enable = true,
       lazy = true,
   },
}

And the integration would decide how to handle lazy.

I guess, the first option is more versatile, and the second is easier for users but less flexible.


Btw. in general, I'm wondering how important is lazy loading in Neovim, when I check profiling information it shows like most plugins start in around 10ms. But I guess it's more a matter of a clean environment without extra auto commands registered, bindings, etc.

@siimon
Copy link
Author

siimon commented Feb 21, 2024

Btw. in general, I'm wondering how important is lazy loading in Neovim, when I check profiling information it shows like most plugins start in around 10ms. But I guess it's more a matter of a clean environment without extra auto commands registered, bindings, etc.

That's a valid point, it's probably the minimalist in me talking and has no real practical reason as of now. So I'm totally fine if this gets punted to the future.

I don't have much experience in either lua and writing neovim plugins so my advice around best solution for this is probably not worth much - but your first suggestion sounds more configurable and could potentially be used in other use cases too. Filetype integrations sounds really smart though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants