Commit Graph

19 Commits (507dd5086093f48e666c99fb509b31721f366df2)

Author SHA1 Message Date
Daniel Sedlak e856906f76
Fix typos (#6643) 2 years ago
Pascal Kuthe f9a25a7e09 detailed snippet tests 2 years ago
Pascal Kuthe 85c9dbf603 accept bracket snippet variables without default 2 years ago
Pascal Kuthe 47420db516 accept empty snippet regex replace elements 2 years ago
Pascal Kuthe 617f09adc4 fix single-char variable names 2 years ago
Pascal Kuthe cabb746b7d do not fail snippet parsing when control chars are not explicitly escaped 2 years ago
Pascal Kuthe 63c23d4bb0 fix typo
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2 years ago
Pascal Kuthe f87299f1b7 allow empty placeholders 2 years ago
Pascal Kuthe 90348b889f revamped snippet text element parsing
Snippet text elements can contain escape sequences
that must be treated properly. Furthermore snippets
must always escape certain characters (like `}`
or `\`). The function has been updated to account
for that. `text` is now also included with
`anything` to match the grammar and can also
match empty text. To avoid infinite loops the
`non-empty` combinator has been added which is
automatically used in the `one_or_more` and
`zero_or more` combinator where the problemn would
occur.
2 years ago
Pascal Kuthe bbf480007d always parse the entire snippet
Previously any remaining text of the snippet that could not be parsed
was ignored. This commit adds the `parse_all` function which reports
an error if any text was not consumed by the parser
2 years ago
Pascal Kuthe cdec933523 avoid allocations during snippet rendering 2 years ago
Andrii Grynenko 0d924255e4 Add nested placeholder parsing for LSP snippets
And fix `text` over-parsing, inspired by
d18f8d5c2d/runtime/lua/vim/lsp/_snippet.lua
2 years ago
Andrii Grynenko 1866b43cd3 Render every LSP snippets for every cursor
This refactors the snippet logic to be largely unaware of the rest of
the document. The completion application logic is moved into
generate_transaction_from_snippet which is extended to support
dynamically computing replacement text.
2 years ago
Urgau ec6e575a40 Correctly handle multiple cursors with LSP snippets 2 years ago
Pascal Kuthe ba24cfe912 Delete snippet placeholders when accepting completion
When accepting a snippet completion we automatically delete the
placeholders for now as doing so manual is quite cumbersome. In the
future we should keep these as a mark + virtual text that is
automatically removed once the cursor moves there.
2 years ago
Urgau ded4381728 Implement LSP snippet tabstops sorting and merging 2 years ago
Michael Davis b9b1ec2208 Apply snippets as transactions 2 years ago
Urgau e973b71c83 Optimize LSP snippet parsing 2 years ago
Michael Davis 9c12e0fb76 Add parser for LSP snippet 2 years ago