review fixes

This commit is contained in:
Stanislav Seletskiy 2015-08-12 17:22:15 +06:00
parent 8ff84758a7
commit 878f79ffda
3 changed files with 28 additions and 9 deletions

View File

@ -1606,7 +1606,7 @@ endsnippet
4.11 Autotrigger *UltiSnips-autotrigger*
----------------
Many language constructions can occur only at specific places, so it's
Many language constructs can occur only at specific places, so it's
possible to use snippets without manually triggering them.
Snippet can be marked as autotriggered by specifying 'A' option in the snippet
@ -1616,6 +1616,9 @@ After snippet is defined as being autotriggered, snippet condition will be
checked on every typed character and if condition matches, then snippet will
be triggered.
*Warning:* using of this feature can lead to significant vim slowdown. If you
discovered that, report an issue to the github.com/SirVer/UltiSnips.
Consider following snippets, that can be usefull in Go programming:
------------------- SNIP -------------------
snippet "^p" "package" rbA
@ -1630,7 +1633,8 @@ endsnippet
------------------- SNAP -------------------
When "p" character will occur in the beginning of the line, it will be
automatically expanded into "package main". Same with "m" character.
automatically expanded into "package main". Same with "m" character. There is
no need to press trigger key after "m".
==============================================================================
5. UltiSnips and Other Plugins *UltiSnips-other-plugins*

View File

@ -40,7 +40,8 @@ class SnippetSource(object):
result = []
for ft in self._get_existing_deep_extends(filetypes):
snips = self._snippets[ft]
result.extend(snips.get_matching_snippets(before, possible, autotrigger_only))
result.extend(snips.get_matching_snippets(before, possible,
autotrigger_only))
return result
def get_clear_priority(self, filetypes):

View File

@ -13,10 +13,15 @@ def has_patch(version, executable):
return int(patch) >= version
def check_required_vim_version(test):
if not has_patch(214, test.vim._vim_executable):
return 'Vim newer than 7.4.214 is required'
else:
return None
class Autotrigger_CanMatchSimpleTrigger(_VimTest):
skip_if = lambda self: 'Vim newer than 7.4.214 is required' if \
not has_patch(214, self.vim._vim_executable) \
else None
skip_if = check_required_vim_version
files = { 'us/all.snippets': r"""
snippet a "desc" A
autotriggered
@ -27,9 +32,7 @@ class Autotrigger_CanMatchSimpleTrigger(_VimTest):
class Autotrigger_CanMatchContext(_VimTest):
skip_if = lambda self: 'Vim newer than 7.4.214 is required' if \
not has_patch(214, self.vim._vim_executable) \
else None
skip_if = check_required_vim_version
files = { 'us/all.snippets': r"""
snippet a "desc" "snip.line == 2" Ae
autotriggered
@ -37,3 +40,14 @@ class Autotrigger_CanMatchContext(_VimTest):
"""}
keys = 'a\na'
wanted = 'autotriggered\na'
class Autotrigger_CanExpandOnTriggerWithLengthMoreThanOne(_VimTest):
skip_if = check_required_vim_version
files = { 'us/all.snippets': r"""
snippet abc "desc" A
autotriggered
endsnippet
"""}
keys = 'abc'
wanted = 'autotriggered'