hsnips
hsnips copied to clipboard
Escaped backslash not showing before right curly brace
The escaped backslash does not appear in the snippet return value \\}
.
Minimal example:
- Create
latex.hsnips
- Define the following snippet
snippet foo A
`` rv = `\\}` ``
endsnippet
- In some
file.tex
, typefoo
- Expected:
\}
, Received:}
To actually output \}
, the RHS needs to be \\\\}
.
Also, the error does not occur for: space-separated \\ }
; individual characters \\
or }
; other braces, e.g., \\{
.
Pretty sure this is intended behavior. The first \ is to escape the } in the hsnips language. Then you need to escape it again so regex spits it in the snippet language, then you regularly escape it inside your regex. Triple escape.
This is also how it works in json (for the Conceal extension).