scnvim icon indicating copy to clipboard operation
scnvim copied to clipboard

[BUG] Luasnip snippets don't escape special characters

Open madskjeldgaard opened this issue 4 years ago • 1 comments

Describe the bug The auto generated LuaSnip format snippets do not escape special characters from default arguments containing things such as \ and " making them disappear, it seems, when you trigger the snippets.

madskjeldgaard avatar Nov 25 '21 09:11 madskjeldgaard

example?

salkin-mada avatar Mar 29 '22 22:03 salkin-mada

Here's an example for a class generated from the Fosc package. The fifth argument has a symbol, which has an unescaped \ which is misinterpreted in Lua. Perhaps all snippet strings should use [[ and ]] instead of double quotes to fix this?

s( {trig = "FoscStartTextSpan.new", name = "FoscStartTextSpan.new", dscr = "Snippet for FoscStartTextSpan.new, auto generated by SCNvim" }, {t("FoscStartTextSpan.new"),t("("),t("leftText:"),i(1, "nil"),t(", "), t("rightText:"),i(2, "nil"),t(", "), t("style:"),i(3, "nil"),t(", "), t("direction:"),i(4, "nil"),t(", "), t("command:"),i(5, "\startTextSpan"),t(", "), t("concatHspaceLeft:"),i(6, "0.5"),t(", "), t("concatHspaceRight:"),i(7, "0.5"),t(", "), t("leftBrokenText:"),i(8, "nil"),t(", "), t("rightPadding:"),i(9, "nil"),t(", "), t("tweaks:"),i(10, "nil"), t(")"),})

madskjeldgaard avatar Sep 10 '23 11:09 madskjeldgaard