hsnips icon indicating copy to clipboard operation
hsnips copied to clipboard

Tabstop with default content not in `t` array

Open 1024th opened this issue 3 years ago • 1 comments

This works fine:

snippet box "Box" A
``rv = '┌' + '─'.repeat(t[0].length + 2) + '┐'``
│ $1 │
``rv = '└' + '─'.repeat(t[0].length + 2) + '┘'``
endsnippet

But when $1 is replaced by ${1:text}, snippet Box fails to expand with error: Cannot read property 'length' of undefined. I checked the value of t.length and got 0.

I noticed that tabstops introduced by js code interpolation are also not in t array (even without default content). The following snippet throws the same error:

snippet box "Box" A
``rv = '┌' + '─'.repeat(t[0].length + 2) + '┐'``
│ ``rv = `${snip.tabstop(1)}` `` │
``rv = '└' + '─'.repeat(t[0].length + 2) + '┘'``
endsnippet

Is there any way to solve this?

1024th avatar Feb 02 '22 17:02 1024th

I agree this would be so usefull!

clemacort avatar Jan 12 '23 14:01 clemacort