Commit graph

239 commits

Author SHA1 Message Date
Diego Augusto S. C
9d08546168 Add log path getter, time format 2024-09-12 20:30:31 +02:00
L3MON4D3
838b2668c5 remove select_keys, just allow direct access to pre_yank and post_yank. 2024-08-20 22:20:40 +02:00
L3MON4D3
9033373173 feat: allow modifying expand-position in pre_expand-callback (#1219). 2024-08-06 23:23:53 +02:00
Peter Strøiman
bc04598500 Fix typo in documentation example code 2024-06-26 11:58:50 +02:00
Nicholas O'Kelley
2b6860d15a
doc: fix typos (close #1187) 2024-06-03 13:17:17 +02:00
gokberkgunes
0a4e557017
Exit snippets upon jumping to $0 (close #1161)
This restores the pre-d9cb6ab-behaviour of completely leaving a snippet once $0 is reached, instead of leaving the possibility of jumping back into it.
This behaviour can be turned on or off via `exit_roots`, and, like the other settings that superseded `history`, `exit_roots` will be set s.t. `history` still/again behaves as expected.
2024-04-30 12:38:47 +02:00
L3MON4D3
97a9742fc0 feat: define callbacks in node-opts.
This circumvents the much more complicated current mechanism of setting
the callback by identifying the node via jump-index in the parent.
2024-02-14 20:22:25 +01:00
L3MON4D3
31007a613c trigEngine: optionally restrict length of trigger (fix #1103). 2024-01-07 10:34:28 +01:00
L3MON4D3
e31c33dd30 document ls_tracked_dofile/ls_tracked_dopackage. 2023-12-31 13:19:05 +01:00
Ote Leo
46d4b07308 Minor DOC.md modifications for panvimdoc lists
Pandoc fails to parse markdown lists unless they come after an empty line. Thus the panvimdoc generated lists are crammed in a single paragraph.
2023-12-26 16:48:13 +01:00
L3MON4D3
c5ce876359 feat(loaders): re-add reload_file (now as official API) (close #1074). 2023-12-03 00:16:01 +01:00
Hawtian Wang
07f217ff03
feat(snip_expand): make indenting snippets optional 2023-12-02 18:11:16 +01:00
L3MON4D3
ce400352e6 feat: major overhaul of loaders. Check DOC.md-changes for the gist.
Previously, we could not
* add files that were not present when `load/lazy_load` was called to
  the collection. This is pretty annoying if one wants to add
  project-local snippets, or snippets for a new filetype (ofc).
* load collections whose directory/package.json(c) did not exist when
  `load` was called.
  This is also an annoyance when creating project-local snippets, since
  a re-`load()` is required for the snippets to be picked up.
* pick up on changes to the snippet-files from another neovim-instance
  (due to reloading on BufWritePost)

This patch fixes all of these by modularizing the loaders a bit more,
into one component ("Collection") which takes care of all the logic of
loading different files, and another ("fswatchers") which notify the
collections when a file-change is detected. This allows, first of all, a
better design where the first concern can be nullified, and secondly, us
to use libuvs api for file-watching, to implement the last two (if a
potentially non-existing collection should be loaded, we can use libuv
to wait for the collection-root/manifest-file, and create the collection
once that exists).

Another cool addition is the loader-snippet-cache, which makes it so
that the snippet files (for vscode and snipmate) are only loaded once
for all filetypes, and not once for each filetype. That's probably not
noticeable though, except if a collection with many extends/languages
for one json-file is loaded :D
2023-12-02 16:24:58 +01:00
L3MON4D3
c0f78cfa18 Don't get selection via buf_get_text, just cut and restore registers.
Easier than taking care of all the stupid edge-cases, like
multibyte-combined-characters or virtualedit.
2023-11-10 22:44:34 +01:00
Steven Jin Xuan
22cbc910c0 Consistent backtick use 2023-11-10 22:34:31 +01:00
L3MON4D3
d9cb6ab976 Overhaul snippet-insertion.
Before this, upon expanding a new snippet, its jumps were linked up
with the currently active node, no matter its position in the buffer.
The most prominent negative side-effect of this is jumping all over the
buffer if a snippet is not jumped "through" (ie. to its $0).
This finally adresses this properly by inserting snippets into nodes
according to their position in the buffer.
Read the changes to `DOC.md` for more info.

This commit also deprecates `history` in `setup`, prefer the new options
`keep_roots`, `link_roots`, and `link_children`, as they are more
readable. Still, it is very unlikely that compatibility with `history`
will ever be completely removed, so no need to fret about this.
2023-10-04 15:11:38 +02:00
Hawtian Wang
a57babc55e implement treesitter-postfix.
See DOC.md-changes for extensive documentation and examples.
2023-09-21 12:42:39 +02:00
Benoit de Chezelles
a2806953e4 feat: Allow desc to set snippet description
Setting the description with `dscr` is still supported.
Access to the description is done through `description` or `dscr`.
2023-09-17 21:09:09 +02:00
Kyle F Hartzenberg
c4d6298347 Update DOC.md structure to include Troubleshooting section
Added an explanation regarding the behaviour of snippet expansion when multiple snippets can potentially expand at the current buffer-position. Re-structured DOC.md to separate Troubleshooting advice into its own section.
2023-08-18 07:05:30 +02:00
Hawtian Wang
f1d81013bc add new option resolveExpandParams for snippets.
The intention of this change is outlined in the amendments to DOC.md,
and in https://github.com/L3MON4D3/LuaSnip/pull/974.
2023-08-13 23:18:47 +02:00
Yifan Hu
153ebee6d1 docs: fix snip-env-src 2023-08-04 10:30:05 +02:00
bhataktaBhai
da831a46f5 added subtraction for condition objects 2023-07-05 12:39:02 +02:00
L3MON4D3
1139ff30c6 jsregexp: use more unique name for OS-detection, update doc. 2023-06-29 22:52:44 +02:00
L3MON4D3
3d0ead32b7 feat: allow vim/ecma-regex/custom-function as triggers.
Check `trigEngine` in `:h luasnip-snippets`, or in `DOC.md`.
2023-06-24 22:57:59 +02:00
L3MON4D3
4c67d50f66 implement support for .code-snippets. 2023-05-31 11:41:35 +02:00
L3MON4D3
bb3ccacf5a prevent snippet-deepcopy, allow scope to override ft from package.json. 2023-05-31 11:41:35 +02:00
L3MON4D3
f8161bc8de allow per-snippet modification of filetype. 2023-05-31 11:41:35 +02:00
Munif Tanjim
64b32a060a docs: cleanup misleading docs for postfix 2023-05-26 14:03:29 +02:00
L3MON4D3
6cabe028dc doc: clean up a bit. 2023-05-26 09:48:23 +02:00
L3MON4D3
9ef2f66ac9 Add key_indexer.
Nodes can be explicitly given some key, and this key can be used in the
args-parameter passed to function/dynamicNode.

This basically makes absolute_indexer useless, since non-sibling nodes
can be addressed much clearer by giving them some key/name, and using
that to reference them, as opposed to reconstructing their exact path
from the snippet-root and passing that.

Furthermore, now all kinds of nodes can be depended on (for example
functionNode)

Lastly, a keyed node can be retrieved via `snippet:get_keyed_node(key)`
in dynamicNode, which can enable more complicated snippets.
2023-05-21 14:57:08 +02:00
L3MON4D3
7dc8d5122f implement function for jumping to source of current snippet. 2023-05-01 22:44:17 +02:00
Merlin Attila Fejzuli
b6a0200069 doc: mention MacOS Makefile variable for jsregexp
The LUAJIT_OSX_PATH variable which allows MacOS users
to specify the location of their lib directory was added in
a835e3d680
and needed to be documented.
2023-04-14 08:39:15 +02:00
JxJxxJxJ
ee625b6bc9 Add has_selected_text-condition. 2023-04-10 20:49:12 +02:00
L3MON4D3
e60e15d05e make headings more uniform. 2023-03-13 10:44:15 +01:00
L3MON4D3
bef7e051b0 add ft_filter to edit_snippet_filetypes (close #635). 2023-03-13 10:43:57 +01:00
L3MON4D3
105e49af07 Add multi-context snippets. 2023-03-08 15:06:53 +01:00
L3MON4D3
de43e81937 init opts at api-boundary, allow conditions from context. 2023-03-08 15:06:53 +01:00
L3MON4D3
ab7d19c96d vscode-loader: parse .jsonc with jsonc-parser. 2023-02-23 19:10:41 +01:00
L3MON4D3
63d12d1f96 feat: add api for getting the position of a node in its buffer. 2023-02-21 00:10:33 +01:00
L3MON4D3
e037dcb8d3 feat: implement getting jump-destination, without actually jumping. 2023-02-21 00:10:33 +01:00
Max
9c659c3239 refactor: use autocmd lua apis. 2023-02-18 16:37:23 +01:00
L3MON4D3
9d4888c40a conf: make snip_env extend default snip_env, by default.
Much more comfortable than having to basically copy the defaults from
the source code just to add a few functions to the snip_env.

It's still possible to get the old "set"-behaviour by passing
`__snip_env_behaviour = "set"` in the `snip_env`.
2023-02-11 23:18:23 +01:00
Evelyn Koo
50e12c4ec4 doc: minor proofreading
- remove some dashes (human readability, though let me know if that might disrupt the actual documentation)
- comma adds/rms
- fix spacing on postfix snippet code highlights
2023-02-07 16:56:08 +01:00
runiq
dc57218d05 Move config reference to DOC.md, update links 2023-02-02 14:47:05 +01:00
Sizhe Zhao
974f780d0a docs: Fix typo in DOC.md and remove trailing spaces 2023-01-20 19:11:59 +01:00
L3MON4D3
bbc497449d fix(doc): ls.parser.parse -> ls.parser.parse_snippet 2023-01-09 20:05:18 +01:00
Lyonel Zamora
9f6c6d0b47 docs(extras): add Snippet List 2023-01-08 10:27:59 +01:00
L3MON4D3
618b945ca2 log: don't print a message on every start, provide log.ping() instead. 2022-12-20 20:44:44 +01:00
L3MON4D3
04d42189a3 doc: fix typo (close #690) 2022-12-11 13:25:44 +01:00
L3MON4D3
1dbaf16536 log: use stdpath("cache") if stdpath("log") is not implemented. 2022-12-10 10:12:28 +01:00