csjs icon indicating copy to clipboard operation
csjs copied to clipboard

Vote for adding support in IntelliJ IDEA

Open kompot opened this issue 9 years ago • 4 comments

Hi guys, thanks for a finally nice approach to CSS-in-JS.

I've created an issue to add improved tagged literal injected language support to IntelliJ IDEA. Please vote there https://youtrack.jetbrains.com/issue/WEB-22106 if you'd like to get it done.

Feel free to delete this issue if it bothers your flow.

Thanks.

kompot avatar Jun 21 '16 04:06 kompot

Hey @kompot, check out this comment for usage in IntelliJ.

I wonder why the template literals are getting parsed as HTML by default for you. When I use WebStorm, they are just interpreted as strings until I use the method above to Language Inject CSS.

Let me know if this helps! Though it would be totally cool if csjs could be auto-detected by an IntelliJ plugin...this is definitely worth exploring as the project gains users.

scott113341 avatar Jun 21 '16 04:06 scott113341

@scott113341 Thanks, I've actually managed to go a bit further and found a way to inject CSS language permanently by using language injection preferences dialog in IDEA and using this pattern.

+ jsLiteralExpression().withText(string().matchesBrics("csjs`.+`"))

But IDEA still does not parse references to variables within CSS. But does that successfully for default template literals assuming it contains plain HTML. So that issue I refer to seems like just a small fix (maybe not, let's see what IDEA's guys are thinking).

kompot avatar Jun 21 '16 05:06 kompot

Ok, so you are miles ahead of me! Thanks for that pattern, that totally did the trick (minus variable interpolation)! I voted for the issue on their tracker; hopefully that is an easy fix for them.

scott113341 avatar Jun 21 '16 05:06 scott113341

+1 For Visual Studio Code too ;-)

avesus avatar Aug 30 '16 18:08 avesus