garymjr / nvim-snippets

Snippet support using native neovim snippets
MIT License
215 stars 13 forks source link

FR: Add snippet reloading function #13

Closed chrisgrieser closed 3 months ago

chrisgrieser commented 3 months ago

I am the dev of nvim-scissors, which is made for editing and creating VSCode-style snippets. It pairs very well with this plugin, even more so than Luasnip.

The only functionality missing to make this plugin a full replacement for Luasnip would be the ability to reload snippet files during runtime. Without it, users would have to restart nvim every time they edit/create a snippet with nvim-scissors.

Luasnip has require("luasnip.loaders").reload_file(filepath) for this, and an equivalent for this plugin would be really useful.

garymjr commented 3 months ago

I added this in #16. You can use Snippets.utils.reload_file(full_path) or require("snippets.utils").reload_file(full_path)

chrisgrieser commented 3 months ago

fantastic, thank you!

chrisgrieser commented 3 months ago

Okay, just added hot-reloading support for nvim-snippets 🥳 https://github.com/chrisgrieser/nvim-scissors/commit/4d62afd396c7f6dd90d1ad324363164a98cc15df

A minor follow-up: could there be an option to suppress the notification when reloading? Reason being that nvim-scissors already notifies the user, and getting two notifications (one from nvim-scissors, one from nvim-snippets) is a bit unnecessary.