tomblachut / svelte-intellij

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

Enable support for different style languages through lang attribute #72

Closed AleksandrSl closed 4 years ago

AleksandrSl commented 4 years ago

Tested manually with stylus and scss. I think that some automatic tests must be added, will take a look at them in nearest future

Resolves #17 Resolves #29

AleksandrSl commented 4 years ago

Related to #17 and I think to #29, it seems to me that IDEA automatically highlight style blocks

AleksandrSl commented 4 years ago

Found no tests for this in Vue plugin ( I also think that different template syntaxes like pug and jade can be supported using similar technique

tomblachut commented 4 years ago

Thx again for the contribution. I'll double check highlighting later.

The problem with Jade is that HTML is extended in Svelte, in contrast to style languages that are used as is. How would you implement if blocks and attribute expressions in Pug? This would also increase maintenance cost in the future, IDEA API changes from time to time :/

AleksandrSl commented 4 years ago

Yeah, I remembered about custom svelte tags in template on the way home(

tomblachut commented 4 years ago

Whoa time flies so fast 😅 Thanks again for your work!

I've checked the PR. Highlighting is off (variable should be blue) image

Guessing from Vue plugin BaseSvelteHtmlHighlightingLexer must be modified similarly to SvelteHtmlLexer.

Whould you be so kind to do it? Otherwise I'll merge this and fix it myself later

tomblachut commented 4 years ago

Closed by mistake

AleksandrSl commented 4 years ago

I will try to fix highlighting in a couple of days!

tomblachut commented 4 years ago

Thx 😄

AleksandrSl commented 4 years ago

Added the same helper to BaseSvelteHtmlHighlightingLexer seems like highlighting works now image

tomblachut commented 4 years ago

Idk why you've reverted accessors. Without them values are set once, upon initialisation and lexers don't work properly.

I've created a patch locally so I'll merge this and add those get()s myself.

Thx for contribution!

AleksandrSl commented 4 years ago

@tomblachut Oh, I understood the problem, for some reason I thought that get() and = will be equal in this case, now I see that they are not)