fix not cleared context

This commit is contained in:
Stanislav Seletskiy 2015-07-09 17:26:56 +06:00
parent 3c4ac11af3
commit bdecd9a8b5
2 changed files with 12 additions and 0 deletions

View File

@ -242,6 +242,7 @@ class SnippetDefinition(object):
self._matched = ''
return False
self._context = None
if match and self._context_code:
self._context = self._context_match()
if not self.context:

View File

@ -138,3 +138,14 @@ class ContextSnippets_CursorIsZeroBased(_VimTest):
keys = "e" + EX
wanted = "(2, 1)"
class ContextSnippets_ContextIsClearedBeforeExpand(_VimTest):
files = { 'us/all.snippets': r"""
pre_expand "snip.context = 1 if snip.context is None else 2"
snippet e "desc" w
`!p snip.rv = str(snip.context)`
endsnippet
"""}
keys = "e" + EX + " " + "e" + EX
wanted = "1 1"