Skip to content

Commit

Permalink
chore(meta_data): update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
molleweide committed Jan 8, 2023
1 parent c4a887b commit 038a2ef
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
13 changes: 13 additions & 0 deletions DOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -2157,6 +2157,19 @@ require("luasnip.loaders").edit_snippet_files {
end
}
```
* `target_snippet`: `table:snippet` If you have config option `store_meta_data`
set to true, then passing a target snippet to the edit function will jump
the cursor to the location where the target snippet is declared.
Currently, this only works for snippets that have been loaded through
`loaders.from_lua`. NOTE: the edit function only uses props that are
returned from `ls.get_context()` so you can either supply a full snip or
the stripped down variant returned from `get_context`.
```lua
require("luasnip.loaders").edit_snippet_files({
target_snippet = my_snippet,
})
```


One comfortable way to call this function is registering it as a command:
```vim
Expand Down
10 changes: 8 additions & 2 deletions doc/luasnip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2117,12 +2117,18 @@ there are multiple) the associated file to edit.
string.format("%s/%s.snippets", <PERSONAL_SNIPPETS_FOLDER>, ft) }
}
end
return {}
end
}
<
- `target_snippet`: `table:snippet` - If you have config option `store_meta_data`
set to true, then passing a target snippet to the edit function will jump
the cursor to the location where the target snippet is declared.
Currently, this only works for snippets that have been loaded through
`loaders.from_lua`. NOTE: the edit function only uses props that are
returned from `ls.get_context()` so you can either supply a full snip or
the stripped down variant returned from `get_context`.

One comfortable way to call this function is registering it as a command:

Expand Down

0 comments on commit 038a2ef

Please sign in to comment.