priority test, docs & fmt fixes

This commit is contained in:
Stanislav Seletskiy 2015-04-27 15:42:21 +06:00
parent 904fbdecf5
commit 1b3ecf4a85
3 changed files with 20 additions and 5 deletions

View File

@ -1333,10 +1333,8 @@ endsnippet
That snippet will expand to 'return err' only if the previous line is starting
from 'if err' prefix.
Note: context snippets prioritized over non-context ones. So, if there are
two snippets with the same trigger, and one of them is context snippet and
it's expression evaluates to 'True', then context snippet will be used for
expansion and first will be ignored.
Note: context snippets prioritized over non-context ones. It makes possible to
use non-context snippets as fallback, if no context matched:
------------------- SNIP -------------------
snippet i "if ..." b

View File

@ -85,3 +85,19 @@ class ContextSnippets_SnippetPriority(_VimTest):
if true {
// pass
}"""
class ContextSnippets_PriorityKeyword(_VimTest):
files = { 'us/all.snippets': r"""
snippet i "desc" "True" e
a
endsnippet
priority 100
snippet i
b
endsnippet
"""}
keys = "i" + EX
wanted = "b"

View File

@ -159,7 +159,8 @@ class MySnippetSource(SnippetSource):
if before.endswith('blumba'):
return [
UltiSnipsSnippetDefinition(
-100, "blumba", "this is a dynamic snippet", "", "", {}, "blub", None)
-100, "blumba", "this is a dynamic snippet", "", "", {}, "blub",
None)
]
return []
""")