tomblachut / svelte-intellij

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

Detect attribute code expressions #30

Closed unlocomqx closed 5 years ago

unlocomqx commented 5 years ago

This should fix https://github.com/tomblachut/svelte-intellij/issues/22 and maybe https://github.com/tomblachut/svelte-intellij/issues/2

screenshot_12

screenshot_13

And also quoted attributes screenshot_19

tomblachut commented 5 years ago

Thanks for contribution!

2 is more complicated because there are many scopes involved - e.g. slot props. Basic syntax syntax highlighting would be easy enough but I din't get a chance to think about real code insight.

unlocomqx commented 5 years ago

Will close for now as we probably won't need the lexer to inject JS into attributes That's how href="javascript: window" does it anyway, it simply uses code injection I lost the exact line of code which handles that, I'll post it later Edit: Here's the line JSInXmlLanguagesInjector.class:80 injectJSIntoAttributeValue(registrar, (XmlAttributeValue)host, true);

tomblachut commented 5 years ago

Unquoted attributes still need to be handled but as you've said injection of some extended SvelteJS is the way to go AFAIK