Closed genericFJS closed 4 months ago
Side note: the case for 'SnippetBlock' uses the same indexOf-code. But there it's less likely to lead to errors (unless one uses type annotations… then both solutions would lead to the same problems).
Thanks, but the fix isn't quite right. The problem is that the snippet AST now looks different, and as such the context?.end
condition is wrong. Will open a PR.
Fix for https://github.com/sveltejs/prettier-plugin-svelte/issues/428
The original codes looks for a closing
)
; the new one looks for a closing}
. Both methods are flawed.The original code would fail a test like
{@render mySnippet($t('my.i18n.code')) }
(this is the example, where the error was found: to fix it the string COULD be passed instead and the method called inside the snippet… but this would break some features of the IDE: translation-string substitution and autocorrect).The new code would fail a test like
{@render mySnippet({my: 'object'}) }
.Are there any ways to use a "real" JS-parser to find the range of the argument-brackets instead of doing these indexOf-workarounds?