File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2923,6 +2923,23 @@ Load via
29232923require (" luasnip.loaders.from_lua" ).load ({paths = " ~/snippets" })
29242924```
29252925
2926+ ### Reloading when editing ` require ` 'd files
2927+ While the lua-snippet-files will be reloaded on edit, this does not
2928+ automatically happen if a file the snippet-file depends on (eg. via ` require ` )
2929+ is changed.
2930+ Since this still may still be desirable, there are two functions exposed when a
2931+ file is loaded by the lua-loader: ` ls_tracked_dofile ` and
2932+ ` ls_tracked_dopackage ` . They perform like ` dofile ` and (almost like) ` require ` ,
2933+ but both register the loaded file internally as a dependency of the
2934+ snippet-file, so it can be reloaded when the loaded file is edited. As stated,
2935+ ` ls_tracked_dofile ` behaves exactly like ` dofile ` , but does the dependency-work
2936+ as well.
2937+ ` ls_tracked_dopackage ` mimics ` require ` in that it does not take a path, but a
2938+ module-name like ` "luasnip.loaders.from_lua" ` , and then searches the
2939+ ` runtimepath/lua ` -directories, and path and cpath for the module.
2940+ Unlike ` require ` , the file will not be cached, since that would complicate the
2941+ reload-on-edit-behaviour.
2942+
29262943## edit_snippets
29272944
29282945To easily edit snippets for the current session, the files loaded by any loader
You can’t perform that action at this time.
0 commit comments