Skip to content

Commit

Permalink
support snip.expand_anon
Browse files Browse the repository at this point in the history
Closes #327
  • Loading branch information
chemzqm committed Sep 15, 2023
1 parent 083150b commit d9138ef
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions python/ultisnips.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,17 @@ def reset_indent(self):
"""Clears the indentation."""
self.indent = self._initial_indent

def expand_anon(
self, value, trigger="", description="", options="", context=None, actions=None
):
pos = vim.eval('coc#cursor#position()')
line = int(pos[0])
character = int(pos[1])
code = 'coc#rpc#notify("snippetInsert", [{"start":{"line":%d,"character":%d},"end":{"line":%d,"character":%d}}, "%s"])' % (line, character - len(trigger), line, character, re.sub(r'"', r'\\\'', value))
vim.eval(code)
return True


# Utility methods
@property
def fn(self): # pylint:disable=no-self-use,invalid-name
Expand Down

0 comments on commit d9138ef

Please sign in to comment.