davidgranstrom / scnvim

Neovim frontend for SuperCollider.
GNU General Public License v3.0
197 stars 26 forks source link

[BUG] Luasnip snippets don't escape special characters #155

Closed madskjeldgaard closed 1 year ago

madskjeldgaard commented 2 years ago

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.

salkin-mada commented 2 years ago

example?

madskjeldgaard commented 1 year ago

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(")"),})