styled-components / webstorm-styled-components

styled-components highlighting support in IntelliJ editors
https://plugins.jetbrains.com/plugin/9997-styled-components
MIT License
375 stars 19 forks source link

[Feature] - highlighting for styled component function signatures #54

Open pr1ntr opened 6 years ago

pr1ntr commented 6 years ago

I was wondering if its possible to make IntelliJ recognize a styled component interpolator based on the function signature?

something like:

export const breakpoint = (gt = 'xs', lte) => (strings, ...interpolation) => css`
  @media (min-width: ${grid[gt]}px) ${lte && grid[lte] ? `(max-width: ${grid[lte]})` : ''} {
    ${css(strings, ...interpolation)}
  }
`

Since it returns css`` and has a signature of (strings, ...interpolation) maybe then the plugin will highlight it as a styled component. I can submit this a feature request too if you have a GitHub

47

VitalyKrenel commented 5 years ago

@pr1ntr do you know about this configuration feature https://github.com/styled-components/webstorm-styled-components/#configuration? It allows u to set up custom tag function names that will be recognized as CSS and thus highlighted.

I know that's not what you exatcly was asking, just for the case you have encountered a problem and needed any solution.

pr1ntr commented 5 years ago

I discovered this recently. Thanks