priority test, docs & fmt fixes
This commit is contained in:
parent
904fbdecf5
commit
1b3ecf4a85
@ -1333,10 +1333,8 @@ endsnippet
|
|||||||
That snippet will expand to 'return err' only if the previous line is starting
|
That snippet will expand to 'return err' only if the previous line is starting
|
||||||
from 'if err' prefix.
|
from 'if err' prefix.
|
||||||
|
|
||||||
Note: context snippets prioritized over non-context ones. So, if there are
|
Note: context snippets prioritized over non-context ones. It makes possible to
|
||||||
two snippets with the same trigger, and one of them is context snippet and
|
use non-context snippets as fallback, if no context matched:
|
||||||
it's expression evaluates to 'True', then context snippet will be used for
|
|
||||||
expansion and first will be ignored.
|
|
||||||
|
|
||||||
------------------- SNIP -------------------
|
------------------- SNIP -------------------
|
||||||
snippet i "if ..." b
|
snippet i "if ..." b
|
||||||
|
@ -85,3 +85,19 @@ class ContextSnippets_SnippetPriority(_VimTest):
|
|||||||
if true {
|
if true {
|
||||||
// pass
|
// 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"
|
||||||
|
@ -159,7 +159,8 @@ class MySnippetSource(SnippetSource):
|
|||||||
if before.endswith('blumba'):
|
if before.endswith('blumba'):
|
||||||
return [
|
return [
|
||||||
UltiSnipsSnippetDefinition(
|
UltiSnipsSnippetDefinition(
|
||||||
-100, "blumba", "this is a dynamic snippet", "", "", {}, "blub", None)
|
-100, "blumba", "this is a dynamic snippet", "", "", {}, "blub",
|
||||||
|
None)
|
||||||
]
|
]
|
||||||
return []
|
return []
|
||||||
""")
|
""")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user