|
1 | | -*luasnip.txt* For NVIM v0.8.0 Last change: 2023 December 27 |
| 1 | +*luasnip.txt* For NVIM v0.8.0 Last change: 2023 December 31 |
2 | 2 |
|
3 | 3 | ============================================================================== |
4 | 4 | Table of Contents *luasnip-table-of-contents* |
@@ -2805,6 +2805,23 @@ Load via |
2805 | 2805 | < |
2806 | 2806 |
|
2807 | 2807 |
|
| 2808 | +RELOADING WHEN EDITING REQUIRE’D FILES ~ |
| 2809 | + |
| 2810 | +While the lua-snippet-files will be reloaded on edit, this does not |
| 2811 | +automatically happen if a file the snippet-file depends on (eg. via `require`) |
| 2812 | +is changed. Since this still may still be desirable, there are two functions |
| 2813 | +exposed when a file is loaded by the lua-loader: `ls_tracked_dofile` and |
| 2814 | +`ls_tracked_dopackage`. They perform like `dofile` and (almost like) `require`, |
| 2815 | +but both register the loaded file internally as a dependency of the |
| 2816 | +snippet-file, so it can be reloaded when the loaded file is edited. As stated, |
| 2817 | +`ls_tracked_dofile` behaves exactly like `dofile`, but does the dependency-work |
| 2818 | +as well. `ls_tracked_dopackage` mimics `require` in that it does not take a |
| 2819 | +path, but a module-name like `"luasnip.loaders.from_lua"`, and then searches |
| 2820 | +the `runtimepath/lua`-directories, and path and cpath for the module. Unlike |
| 2821 | +`require`, the file will not be cached, since that would complicate the |
| 2822 | +reload-on-edit-behaviour. |
| 2823 | + |
| 2824 | + |
2808 | 2825 | EDIT_SNIPPETS *luasnip-loaders-edit_snippets* |
2809 | 2826 |
|
2810 | 2827 | To easily edit snippets for the current session, the files loaded by any loader |
|
0 commit comments