cbochs / grapple.nvim

Neovim plugin for tagging important files
MIT License
545 stars 20 forks source link

fix(state): ensure default scope_resolver is stored in metatable when loading from resession #80

Closed Subjective closed 7 months ago

Subjective commented 1 year ago

Currently, resession integration is a bit incomplete since the state.load_all function does not set the __resolver metadata in the scope_state metatables. This causes nil index errors when trying to call require("grapple").reset().

  1. The solution implemented here allows for an optional scope_resolver (which defaults to settings.scope to be passed into load_all, which is then used to set all the __resolver metadata. This ensures that the __resolver metadata is set, avoiding the nil index errors.

  2. I also changed the behavior of ensure_loaded so that it always overrides and sets the __resolver metadata. Before, it would just return and do nothing if the scope_state was not empty, which intuitively doesn't really make much since because it isn't really "ensuring" that the scope_resolver is always being set. This alone is actually sufficient to fix the resession integration issues, but I still think the changes made in 1) are reasonable (though not really necessary).

A brief comment: I'm not sure if this project is still being maintained or if you'll ever read this, but on the off chance you do, I just wanted to thank you for all the hard work you've put into grapple. I truly think it's the best at what it does despite being heavily underrated (though I do know many people who prefer using it over harpoon). Your dedication to this project shows in its quality, and I along with many people are truly grateful for this amazing plugin you've contributed. Thanks!

cbochs commented 7 months ago

Thank you for the PR! Going to close as #89 addresses these changes