Closed mmalicki closed 6 years ago
Thanks for a such detailed response!
Indeed, this handling of generic template literals felt somewhat hacky, as it didn't appear to be recognized properly by Intellij - I should have done more research. Glad that it works now out of the box in 2018.2 build.
I will close that PR, as it's not needed.
Thanks for the pull request! It's great to see someone take an interest in the code.
Unfortunately, I don't think it's needed at all.
Template string generic type arguments were added in Typescript 2.9 in April and aren't parsed in any way correctly in IDE versions released prior to that (generic type arguments are represented in WebStorm/IDEA syntax structure by
TypeScriptTypeArgumentList
,JSBinaryExpression
is used only for actual binary expressions).While the current approach is a good first start and handles simple cases, unfortunately, TypeScript has much more complicated types which would be difficult to handle without correct parsing (see examples below)...
WebStorm 2018.2 EAP builds parse type arguments correctly after support was added in this issue and the plugin correctly highlights styled-components code for me in 2018.2:
2018.2 EAP builds are available on the WebStorm EAP page (or a similar page for other IDEs). A release is planned for the second half of July.