tomblachut / svelte-intellij

Svelte components in WebStorm and friends
MIT License
485 stars 38 forks source link

Expressions inside textarea tag are parsed as plain text #142

Closed tomblachut closed 1 year ago

tomblachut commented 4 years ago

Refer to this test: https://github.com/sveltejs/svelte/tree/master/test/parser/samples/textarea-children

And this repl:

https://svelte.dev/repl/1e98afa6a765431d9368139f9f48c6dc?version=3.24.1

shirotech commented 4 years ago

Was wondering if we can borrow XML handle of CDATA, just a thought if it might be that simple?

tomblachut commented 4 years ago

Maybe, good idea. Anyway this is doable on xml lexer level (SvelteHtmlHighlightingLexer & SvelteHtmlLexer), similar to how CSS and other style langs are handled, in that case lang will be plain text or "nothing".

Svelte {expressions} are handled on higher level, there's explicit exception for style and script so { } lexing is delegated to JS and CSS. We don't want this delegation in textarea so SvelteHtmlLexer.flex is unaffected

tomblachut commented 3 years ago

https://youtrack.jetbrains.com/issue/WEB-41745 fixed this issue, then https://github.com/sveltejs/svelte/pull/6148 happened, so now, Expressions inside textarea tag are parsed as plain text seems like a better issue name

tomblachut commented 1 year ago

Migrated to WEB-61784 Svelte: properly parse textarea tag content