Add generic tagged template literals support#50
Add generic tagged template literals support#50mmalicki wants to merge 1 commit intostyled-components:masterfrom mmalicki:master
Conversation
mxstbr
left a comment
There was a problem hiding this comment.
I'm not very aware of all this code so forgive me if this is a wrong comment, but we definitely do not want to highlight all tagged template literals. People use them for things other than CSS.
|
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 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: import styled from 'styled-components';
let one = styled.div<Foo>`color:red`;
let another = styled.div<Foo<number>>`color:yellow`;
let withCallback = styled.div<Foo<Bar<{ onClick: () => void }>>>`color:yellow`;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. |
|
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. |


No description provided.