1
0
Fork 0
mirror of synced 2024-11-26 10:45:35 -05:00
ultimate-vim/sources_non_forked/vim-snippets/pythonx/vimsnippets.py
2014-04-18 13:58:02 +01:00

20 lines
471 B
Python

"""Helper methods used in UltiSnips snippets."""
def complete(tab, opts):
"""
get options that start with tab
:param tab: query string
:param opts: list that needs to be completed
:return: a string that start with tab
"""
msg = "({0})"
if tab:
opts = [m[len(tab):] for m in opts if m.startswith(tab)]
if len(opts) == 1:
return opts[0]
if not len(opts):
msg = "{0}"
return msg.format("|".join(opts))