Commit Graph

11 Commits (90348b889f397f2753473764c2d7a02986beddeb)

Author SHA1 Message Date
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.
1 year 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
1 year ago
Pascal Kuthe cdec933523 avoid allocations during snippet rendering 1 year 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
1 year 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.
1 year ago
Urgau ec6e575a40 Correctly handle multiple cursors with LSP snippets 1 year 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.
1 year ago
Urgau ded4381728 Implement LSP snippet tabstops sorting and merging 1 year ago
Michael Davis b9b1ec2208 Apply snippets as transactions 1 year ago
Urgau e973b71c83 Optimize LSP snippet parsing 1 year ago
Michael Davis 9c12e0fb76 Add parser for LSP snippet 1 year ago