Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
90ef60a
refactor: put all api-function into their own class.
L3MON4D3 Jun 17, 2025
af1420c
Add more documentation.
L3MON4D3 Jun 17, 2025
91dddd0
doc: add code for generating docstrings from annotations.
L3MON4D3 Jun 17, 2025
c314824
gitignore build artifacts from doc.
L3MON4D3 Jun 17, 2025
b7abead
finish doc for init.lua, document ChoiceNode.C, update luals-mdgen.
L3MON4D3 Jun 18, 2025
8b327ce
remove doc.json, is build artifact.
L3MON4D3 Jun 18, 2025
79e7ab1
ci: add DOC.md-generation to push workflow.
L3MON4D3 Jun 18, 2025
aec181e
whoops!
L3MON4D3 Jun 18, 2025
f34a4ac
remove old comment.
L3MON4D3 Jun 19, 2025
8605dc1
nix: update luals-mdgen.
L3MON4D3 Jun 19, 2025
58b431d
make sure there are empty lines before any lists.
L3MON4D3 Jun 19, 2025
0d86256
update dictionary.
L3MON4D3 Jun 19, 2025
6948930
ci: use aspell directly for running spellcheck.
L3MON4D3 Jun 19, 2025
5130823
move DOC-template.md into ./data/.
L3MON4D3 Jun 19, 2025
ea7ba6d
doc: specify special-case of textNode as a choice.
L3MON4D3 Jun 20, 2025
7113cfe
ci: fix spell workflow.
L3MON4D3 Jun 20, 2025
c334ff1
update luals-mdgen.
L3MON4D3 Jun 20, 2025
678b5bf
spellcheck: set locale-dependent encoding, fix spellcheck_interactive.
L3MON4D3 Jun 20, 2025
0b37dca
Auto generate docs
L3MON4D3 Jun 20, 2025
592a634
Format with stylua
L3MON4D3 Jun 20, 2025
9659b9d
doc: add panvimdoc and vimdoc make-step, use in ci.
L3MON4D3 Jun 22, 2025
a3e75ee
re-generate doc.
L3MON4D3 Jun 22, 2025
9611fc1
doc: don't be too verbose about return-values.
L3MON4D3 Jun 22, 2025
964cff2
doc: add newlines in long doc-blocks.
L3MON4D3 Jun 22, 2025
338d9a9
Auto generate docs
L3MON4D3 Jun 22, 2025
6e9fc6d
doc: s/--/---/
L3MON4D3 Jun 22, 2025
357800b
doc: make sure class-doc is above @class.
L3MON4D3 Jun 22, 2025
e15ad06
annotations: replace table<x,y> with {[x]: y}.
L3MON4D3 Jun 22, 2025
5857a31
annotations: make type a bit more strict.
L3MON4D3 Jun 22, 2025
407ebb9
regenerate doc.
L3MON4D3 Jun 22, 2025
ac1ee19
update helptags after updating vimdoc.
L3MON4D3 Jun 22, 2025
06e6084
use panvimdoc-fork.
L3MON4D3 Jun 22, 2025
cdeed19
annotations: add return-type for get_snip_env.
L3MON4D3 Jun 22, 2025
11a250d
generate api-doc as subsubsubheadings.
L3MON4D3 Jun 22, 2025
8484341
panvimdoc: drop unnecessary flag.
L3MON4D3 Jun 22, 2025
b9e6223
doc: generate DOC.md once with panvimdoc-links, once without.
L3MON4D3 Jun 22, 2025
bec3c1b
doc: add empty line before list.
L3MON4D3 Jun 22, 2025
0c90008
doc: generate documentation before running luals-mdgen.
L3MON4D3 Jun 23, 2025
c49fdb2
doc: update luals-mdgen.
L3MON4D3 Jun 23, 2025
4bf7206
LuaSnip.Choice -> LuaSnip.ChoiceNode.ItemNode.
L3MON4D3 Jun 23, 2025
da6eee4
Few annotations tweaks
bew Jun 23, 2025
e0b81c1
Include changes for the other comments on #1353
bew Jun 23, 2025
4bfc49c
Apply suggestions
bew Jun 23, 2025
62c62e9
Add in-comment indent in doc annotations for top-doc & line continuation
bew Jun 23, 2025
ae20fa1
re-generate doc.
L3MON4D3 Jun 23, 2025
f5cdf05
add missing annotations.
L3MON4D3 Jun 23, 2025
707f89e
update luals-mdgen.
L3MON4D3 Jun 23, 2025
b0fdce2
add one last missing parameter.
L3MON4D3 Jun 23, 2025
3ccbb4f
shuffle around choiceNode doc.
L3MON4D3 Jun 24, 2025
a70f977
update luals-mdgen.
L3MON4D3 Jun 24, 2025
a47e5aa
make sure links are formatted correctly.
L3MON4D3 Jun 24, 2025
cd0f3c4
add missing newline before list.
L3MON4D3 Jun 24, 2025
5be06e2
update panvimdoc.
L3MON4D3 Jun 24, 2025
68faade
upate luals-mdgen.
L3MON4D3 Jun 24, 2025
fe21c82
update luals-mdgen.
L3MON4D3 Jun 24, 2025
fb4b3fa
update panvimdoc.
L3MON4D3 Jun 25, 2025
d8cee89
doc: briefly expand how to create a `LuaSnip.Addable`.
L3MON4D3 Jun 25, 2025
fbbd855
doc: add missing explanation for clean_invalidated-opts.
L3MON4D3 Jun 25, 2025
c9f081a
update panvimdoc.
L3MON4D3 Jun 25, 2025
75baad0
doc: render vimdoc-markdown with textwidth 80.
L3MON4D3 Jun 25, 2025
bd39313
doc: remove conflicting `LuaSnip.Snippet` definition.
L3MON4D3 Jun 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
upate luals-mdgen.
  • Loading branch information
L3MON4D3 committed Jun 24, 2025
commit 68faadec0f8c5ecadcdf53aec526bbe4fbfe2dd0
40 changes: 26 additions & 14 deletions DOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,11 @@ ChoiceNodes allow choosing between multiple nodes.
`c(pos, choices, opts?): LuaSnip.ChoiceNode`: Create a new choiceNode from a list of choices.
The first item in this list is the initial choice, and it can be changed while any node of a choice
is active. So, if all choices should be reachable, every choice has to have a place for the cursor
to stop at. If the choice is a snippetNode like `sn(nil, {...nodes...})` the given `nodes` have to
contain an `insertNode` (e.g. `i(1)`). Using an `insertNode` or `textNode` directly as a choice is
also fine, the latter is special-cased to have a jump-point at the beginning of its text.
to stop at.

If the choice is a snippetNode like `sn(nil, {...nodes...})` the given `nodes` have to contain an
`insertNode` (e.g. `i(1)`). Using an `insertNode` or `textNode` directly as a choice is also fine,
the latter is special-cased to have a jump-point at the beginning of its text.

* `pos: integer` Jump-index of the node. (See [Basics-Jump-Index](#jump-index))
* `choices: (LuaSnip.Node|LuaSnip.Node[])[]` A list of nodes that can be switched between
Expand All @@ -766,9 +768,11 @@ also fine, the latter is special-cased to have a jump-point at the beginning of
* `restore_cursor?: boolean?` If set, the currently active node is looked up in the switched-to
choice, and the cursor restored to preserve the current position relative to that node. The node
may be found if a `restoreNode` is present in both choice. Defaults to `false`, as enabling
might lead to decreased performance. It's possible to override the default by wrapping the
`choiceNode` constructor in another function that sets `opts.restore_cursor` to `true` and then
using that to construct `choiceNode`s:
might lead to decreased performance.

It's possible to override the default by wrapping the `choiceNode` constructor in another
function that sets `opts.restore_cursor` to `true` and then using that to construct
`choiceNode`s:
```lua
local function restore_cursor_choice(pos, choices, opts)
opts = opts or {}
Expand Down Expand Up @@ -3917,7 +3921,9 @@ Expand a snippet in the current buffer.
* `expand_params?: LuaSnip.Opts.SnipExpandExpandParams?` Override various fields of the expanded
snippet. Don't override anything by default. This is useful for manually expanding snippets
where the trigger passed via `trig` is not the text triggering the snippet, or those which
expect `captures` (basically, snippets with a non-plaintext `trigEngine`). One Example:
expect `captures` (basically, snippets with a non-plaintext `trigEngine`).

One Example:
```lua
snip_expand(snip, {
trigger = "override_trigger",
Expand Down Expand Up @@ -4062,7 +4068,9 @@ snippet.

#### `filetype_extend(ft, extend_ft)`

Add `extend_ft` filetype to inherit its snippets from `ft`. Example:
Add `extend_ft` filetype to inherit its snippets from `ft`.

Example:
```lua
ls.filetype_extend("sh", {"zsh"})
ls.filetype_extend("sh", {"bash"})
Expand All @@ -4074,7 +4082,9 @@ This makes all `sh` snippets available in `sh`/`zsh`/`bash` `zsh`/`bash` `bash`

#### `filetype_set(ft, fts)`

Set `fts` filetypes as inheriting their snippets from `ft`. Example:
Set `fts` filetypes as inheriting their snippets from `ft`.

Example:
```lua
ls.filetype_set("sh", {"sh", "zsh", "bash"})
```
Expand All @@ -4098,9 +4108,10 @@ has received new snippets.

#### `setup_snip_env()`

Injects the fields defined in `snip_env`, in `setup`, into the callers global environment. This
means that variables like `s`, `sn`, `i`, `t`, ... (by default) work, and are useful for quickly
testing snippets in a buffer:
Injects the fields defined in `snip_env`, in `setup`, into the callers global environment.

This means that variables like `s`, `sn`, `i`, `t`, ... (by default) work, and are useful for
quickly testing snippets in a buffer:
```lua
local ls = require("luasnip")
ls.setup_snip_env()
Expand Down Expand Up @@ -4129,8 +4140,9 @@ Get the snippet corresponding to some id.

#### `add_snippets(ft?, snippets, opts?)`

Add snippets to luasnip's snippet-collection. NOTE: Calls `refresh_notify` as needed if enabled via
`opts.refresh_notify`.
Add snippets to luasnip's snippet-collection.

NOTE: Calls `refresh_notify` as needed if enabled via `opts.refresh_notify`.

* `ft?: string?` The filetype to add the snippets to, or nil if the filetype is specified in
`snippets`.
Expand Down
40 changes: 25 additions & 15 deletions doc/luasnip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -770,11 +770,12 @@ ChoiceNodes allow choosing between multiple nodes.
list of choices.
The first item in this list is the initial choice, and it can be changed while
any node of a choice is active. So, if all choices should be reachable, every
choice has to have a place for the cursor to stop at. If the choice is a
snippetNode like `sn(nil, {...nodes...})` the given `nodes` have to contain an
`insertNode` (e.g. `i(1)`). Using an `insertNode` or `textNode` directly as a
choice is also fine, the latter is special-cased to have a jump-point at the
beginning of its text.
choice has to have a place for the cursor to stop at.

If the choice is a snippetNode like `sn(nil, {...nodes...})` the given `nodes`
have to contain an `insertNode` (e.g. `i(1)`). Using an `insertNode` or
`textNode` directly as a choice is also fine, the latter is special-cased to
have a jump-point at the beginning of its text.

- `pos: integer` Jump-index of the node. (See |luasnip-basics-jump-index|)
- `choices: (LuaSnip.Node|LuaSnip.Node[])[]` A list of nodes that can be switched
Expand All @@ -788,9 +789,10 @@ beginning of its text.
the switched-to choice, and the cursor restored to preserve the current
position relative to that node. The node may be found if a `restoreNode` is
present in both choice. Defaults to `false`, as enabling might lead to
decreased performance. It’s possible to override the default by wrapping the
`choiceNode` constructor in another function that sets `opts.restore_cursor` to
`true` and then using that to construct `choiceNode`s:
decreased performance.
It’s possible to override the default by wrapping the `choiceNode`
constructor in another function that sets `opts.restore_cursor` to `true` and
then using that to construct `choiceNode`s:
>lua
local function restore_cursor_choice(pos, choices, opts)
opts = opts or {}
Expand Down Expand Up @@ -3843,7 +3845,8 @@ Expand a snippet in the current buffer.
of the expanded snippet. Don’t override anything by default. This is useful
for manually expanding snippets where the trigger passed via `trig` is not the
text triggering the snippet, or those which expect `captures` (basically,
snippets with a non-plaintext `trigEngine`). One Example:
snippets with a non-plaintext `trigEngine`).
One Example:
>lua
snip_expand(snip, {
trigger = "override_trigger",
Expand Down Expand Up @@ -4006,7 +4009,9 @@ the end/beginning of the next/previous snippet.

filetype_extend(ft, extend_ft) *luasnip-api-filetype_extend*

Add `extend_ft` filetype to inherit its snippets from `ft`. Example:
Add `extend_ft` filetype to inherit its snippets from `ft`.

Example:

>lua
ls.filetype_extend("sh", {"zsh"})
Expand All @@ -4022,7 +4027,9 @@ buffers.

filetype_set(ft, fts) *luasnip-api-filetype_set*

Set `fts` filetypes as inheriting their snippets from `ft`. Example:
Set `fts` filetypes as inheriting their snippets from `ft`.

Example:

>lua
ls.filetype_set("sh", {"sh", "zsh", "bash"})
Expand Down Expand Up @@ -4054,8 +4061,10 @@ plugins that a filetype has received new snippets.
setup_snip_env() *luasnip-api-setup_snip_env*

Injects the fields defined in `snip_env`, in `setup`, into the callers global
environment. This means that variables like `s`, `sn`, `i`, `t`, … (by
default) work, and are useful for quickly testing snippets in a buffer:
environment.

This means that variables like `s`, `sn`, `i`, `t`, … (by default) work, and
are useful for quickly testing snippets in a buffer:

>lua
local ls = require("luasnip")
Expand Down Expand Up @@ -4089,8 +4098,9 @@ Get the snippet corresponding to some id.

add_snippets(ft?, snippets, opts?) *luasnip-api-add_snippets*

Add snippets to luasnip’s snippet-collection. NOTE: Calls `refresh_notify` as
needed if enabled via `opts.refresh_notify`.
Add snippets to luasnip’s snippet-collection.

NOTE: Calls `refresh_notify` as needed if enabled via `opts.refresh_notify`.

- `ft?: string?` The filetype to add the snippets to, or nil if the filetype is specified in
`snippets`.
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.