Skip to content

Commit

Permalink
Auto generate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kylefhartzenberg authored and github-actions[bot] committed Aug 16, 2023
1 parent 91827eb commit ef5b521
Showing 1 changed file with 64 additions and 51 deletions.
115 changes: 64 additions & 51 deletions doc/luasnip.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*luasnip.txt* For NVIM v0.8.0 Last change: 2023 August 15
*luasnip.txt* For NVIM v0.8.0 Last change: 2023 August 16

==============================================================================
Table of Contents *luasnip-table-of-contents*
Expand Down Expand Up @@ -45,21 +45,22 @@ Table of Contents *luasnip-table-of-contents*
- Environment Namespaces |luasnip-variables-environment-namespaces|
- LSP-Variables |luasnip-variables-lsp-variables|
20. Loaders |luasnip-loaders|
- Troubleshooting |luasnip-loaders-troubleshooting|
- VS-Code |luasnip-loaders-vs-code|
- SNIPMATE |luasnip-loaders-snipmate|
- Lua |luasnip-loaders-lua|
- edit_snippets |luasnip-loaders-edit_snippets|
21. SnippetProxy |luasnip-snippetproxy|
22. ext_opts |luasnip-ext_opts|
23. Docstrings |luasnip-docstrings|
24. Docstring-Cache |luasnip-docstring-cache|
25. Events |luasnip-events|
26. Cleanup |luasnip-cleanup|
27. Logging |luasnip-logging|
28. Source |luasnip-source|
29. Config-Options |luasnip-config-options|
30. API |luasnip-api|
21. Troubleshooting |luasnip-troubleshooting|
- Adding Snippets |luasnip-troubleshooting-adding-snippets|
- VS-Code |luasnip-troubleshooting-vs-code|
- SNIPMATE |luasnip-troubleshooting-snipmate|
- Lua |luasnip-troubleshooting-lua|
- edit_snippets |luasnip-troubleshooting-edit_snippets|
22. SnippetProxy |luasnip-snippetproxy|
23. ext_opts |luasnip-ext_opts|
24. Docstrings |luasnip-docstrings|
25. Docstring-Cache |luasnip-docstring-cache|
26. Events |luasnip-events|
27. Cleanup |luasnip-cleanup|
28. Logging |luasnip-logging|
29. Source |luasnip-source|
30. Config-Options |luasnip-config-options|
31. API |luasnip-api|
>
__ ____
/\ \ /\ _`\ __
Expand Down Expand Up @@ -2189,13 +2190,20 @@ such a framework is edited.
<


TROUBLESHOOTING *luasnip-loaders-troubleshooting*
==============================================================================
21. Troubleshooting *luasnip-troubleshooting*

- LuaSnip uses `all` as the global filetype. As most snippet collections don’t
explicitly target LuaSnip, they may not provide global snippets for this
filetype, but another, like `_` (`honza/vim-snippets`). In these cases, it’s
necessary to extend LuaSnip’s global filetype with the collection’s global
filetype:

ADDING SNIPPETS *luasnip-troubleshooting-adding-snippets*


LOADERS ~

- **Filetypes**. LuaSnip uses `all` as the global filetype. As most snippet
collections don’t explicitly target LuaSnip, they may not provide global
snippets for this filetype, but another, like `_` (`honza/vim-snippets`). In
these cases, it’s necessary to extend LuaSnip’s global filetype with the
collection’s global filetype:
>lua
ls.filetype_extend("all", { "_" })
<
Expand All @@ -2209,14 +2217,19 @@ TROUBLESHOOTING *luasnip-loaders-troubleshooting*
>lua
ls.filetype_extend("<luasnip-filetype>", { "<collection-filetype>" })
<
- As we only load `lazy_load`ed snippets on some events, `lazy_load` will
probably not play nice when a non-default `ft_func` is used: if it depends on
e.g. the cursor position, only the filetypes for the cursor position when the
`lazy_load` events are triggered will be loaded. Check
- **Non-default ft_func loading**. As we only load `lazy_load`ed snippets on some
events, `lazy_load` will probably not play nice when a non-default `ft_func` is
used: if it depends on e.g. the cursor position, only the filetypes for the
cursor position when the `lazy_load` events are triggered will be loaded. Check
|luasnip-extras-filetype-function|’s `extend_load_ft` for a solution.
- If multiple snippets could be triggered at the current buffer-position, the
snippet that was defined first in one’s configuration will be expanded first.
As a small, real-world LaTeX math example, given the following two snippets:


GENERAL ~

- **Snippets sharing triggers**. If multiple snippets could be triggered at the
current buffer-position, the snippet that was defined first in one’s
configuration will be expanded first. As a small, real-world LaTeX math
example, given the following two snippets with triggers `.ov` and `ov`:
>lua
postfix( -- Insert over-line command to text via post-fix
{ trig = ".ov", snippetType = "autosnippet" },
Expand All @@ -2235,19 +2248,19 @@ TROUBLESHOOTING *luasnip-loaders-troubleshooting*
)
),
<
If one types `x` followed by `.ov`, the postfix snippet expands correctly
producing `\overline{x}`. However, if the `postfix` snippet above is defined
_after_ the normal snippet `s`, then the same key press sequence produces
`x.\overline{}`. This behaviour can be overridden by explicitly providing a
priority to such snippets. For example, in the above code, if the `postfix`
snippet was defined after the normal snippet `s`, then adding `priority=1001`
to the `postfix` snippet will cause it to expand as if it were defined before
the normal snippet `s`. Snippet `priority` is discussed in the Snippets section
If one types `x` followed by `.ov`, the postfix snippet expands producing
`\overline{x}`. However, if the `postfix` snippet above is defined _after_ the
normal snippet `s`, then the same key press sequence produces `x.\overline{}`.
This behaviour can be overridden by explicitly providing a priority to such
snippets. For example, in the above code, if the `postfix` snippet was defined
after the normal snippet `s`, then adding `priority=1001` to the `postfix`
snippet will cause it to expand as if it were defined before the normal snippet
`s`. Snippet `priority` is discussed in the Snippets section
<https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md#snippets> of the
documentation.


VS-CODE *luasnip-loaders-vs-code*
VS-CODE *luasnip-troubleshooting-vs-code*

As a reference on the structure of these snippet libraries, see
`friendly-snippets` <https://github.com/rafamadriz/friendly-snippets>.
Expand Down Expand Up @@ -2415,7 +2428,7 @@ This file can be loaded by calling
<


SNIPMATE *luasnip-loaders-snipmate*
SNIPMATE *luasnip-troubleshooting-snipmate*

Luasnip does not support the full snipmate format: Only `./{ft}.snippets` and
`./{ft}/*.snippets` will be loaded. See honza/vim-snippets
Expand Down Expand Up @@ -2469,7 +2482,7 @@ Stuff to watch out for:
future.


LUA *luasnip-loaders-lua*
LUA *luasnip-troubleshooting-lua*

Instead of adding all snippets via `add_snippets`, it’s possible to store
them in separate files and load all of those. The file-structure here is
Expand Down Expand Up @@ -2543,7 +2556,7 @@ Load via
<


EDIT_SNIPPETS *luasnip-loaders-edit_snippets*
EDIT_SNIPPETS *luasnip-troubleshooting-edit_snippets*

To easily edit snippets for the current session, the files loaded by any loader
can be quickly edited via
Expand Down Expand Up @@ -2612,7 +2625,7 @@ One comfortable way to call this function is registering it as a command:


==============================================================================
21. SnippetProxy *luasnip-snippetproxy*
22. SnippetProxy *luasnip-snippetproxy*

`SnippetProxy` is used internally to alleviate the upfront cost of loading
snippets from e.g. a SnipMate library or a VSCode package. This is achieved by
Expand Down Expand Up @@ -2644,7 +2657,7 @@ while this will parse the snippet upon expansion:


==============================================================================
22. ext_opts *luasnip-ext_opts*
23. ext_opts *luasnip-ext_opts*

`ext_opts` can be used to set the `opts` (see `nvim_buf_set_extmark`) of the
extmarks used for marking node positions, either globally, per snippet or per
Expand Down Expand Up @@ -2845,7 +2858,7 @@ always visible on top of it.


==============================================================================
23. Docstrings *luasnip-docstrings*
24. Docstrings *luasnip-docstrings*

Snippet docstrings can be queried using `snippet:get_docstring()`. The function
evaluates the snippet as if it was expanded regularly, which can be problematic
Expand Down Expand Up @@ -2896,7 +2909,7 @@ example to understand `docTrig` and `docstring`.


==============================================================================
24. Docstring-Cache *luasnip-docstring-cache*
25. Docstring-Cache *luasnip-docstring-cache*

Although generation of docstrings is pretty fast, it’s preferable to not redo
it as long as the snippets haven’t changed. Using
Expand All @@ -2914,7 +2927,7 @@ The cache is located at `stdpath("cache")/luasnip/docstrings.json` (probably


==============================================================================
25. Events *luasnip-events*
26. Events *luasnip-events*

Events can be used to react to some action inside snippets. These callbacks can
be defined per snippet (`callbacks`-key in snippet constructor) or globally
Expand Down Expand Up @@ -3002,15 +3015,15 @@ or some information about expansions:


==============================================================================
26. Cleanup *luasnip-cleanup*
27. Cleanup *luasnip-cleanup*

The function ls.cleanup() triggers the `LuasnipCleanup` user event, that you
can listen to do some kind of cleaning in your own snippets; by default it will
empty the snippets table and the caches of the lazy_load.


==============================================================================
27. Logging *luasnip-logging*
28. Logging *luasnip-logging*

Luasnip uses logging to report unexpected program states, and information on
what’s going on in general. If something does not work as expected, taking a
Expand All @@ -3033,7 +3046,7 @@ print a short message to the log.


==============================================================================
28. Source *luasnip-source*
29. Source *luasnip-source*

It is possible to attach, to a snippet, information about its source. This can
be done either by the various loaders (if it is enabled in `ls.setup`
Expand Down Expand Up @@ -3068,7 +3081,7 @@ It is also possible to get/set the source of a snippet via API:


==============================================================================
29. Config-Options *luasnip-config-options*
30. Config-Options *luasnip-config-options*

These are the settings you can provide to `luasnip.setup()`:

Expand Down Expand Up @@ -3141,7 +3154,7 @@ These are the settings you can provide to `luasnip.setup()`:


==============================================================================
30. API *luasnip-api*
31. API *luasnip-api*

`require("luasnip")`:

Expand Down

0 comments on commit ef5b521

Please sign in to comment.