Can't add new snippets without reloading plugin due to caching
camgraff opened this issue · 3 comments
Since the snippets cache is never invalidated, it is not possible to add new snippets using :UltiSnipsEdit
without reloading this plugin, as the new snippets are not picked up when completion is invoked.
IMO, there should be no need for caching. I read this issue which it seems led to the cache implementation, but I've not seen any noticeable performance change with vs. without caching. I'd be happy to be proven wrong about this though.
Ideally, this plugin would handle the cache invalidation intelligently, but I can see that being very difficult to implement reliably. At the very least, I think there should be an option to disable caching or a way to manually invalidate the cache that I can hook into an autocmd or something.
Hey, thank you for your opinion. This was my thought as well when I was implementing the caching.
Surely if the snippets are just hundreds, there's no need to cache at all
But It would not quite efficient when it's loading a thousand snippets without caching (people could use many snippets sources as they wish to use: e.g honza/vim-snippets).
I will check and could add the option to configure the cache (disable, or enable) on the configuration, or add an autocmd for auto invalidating the cache.
Hey, I have thought about implementing this as well because it is quite annoying being
forced to restart Neovim to get new snippets to show up. We could create a command that clears
all caches (essentially the snippet_info_for_file
and snippet_info_for_ft
tables).
Then load_snippet_info()
should parse all files and snippets again.
@quangnguyen30192 let me know in case you have started implementing this feature
@camgraff the cache now is auto invalidate whenever the snippet files are edited