Closed yfzhao20 closed 2 years ago
I know how to solve that. Just set one more parameter and then throw snip
into it in snippet blocks:
global
function test(snippet, index){
var result = ""
for (var i = 0; i < index ; i++){
result += ("Test " +`${snippet.tabstop(i+1)}` +" it! \n")
}
return result
}
endglobal
snippet `test(\d)` "test" iA
``rv=test(snip, m[1])``
endsnippet
I'm modifying my
hsnips
script to fit HyperSnips 0.2.7. Now I meet a new problem.test code:
Then create
test.md
and then inputtest3
. Wanted result isHowever it throws "snip is not defined" error.
But if I move the definition of function into snippet block, like that:
Then Everything will be OK.
So how to fix that? I think
snip
cannot be used inglobal
block, but I cannot find the solution. 🧐Thanks!