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

Make more generic by adding `<style>` support #34

Closed smeijer closed 5 years ago

smeijer commented 7 years ago

Would be awesome if this plugin could also add support for the <style> tag.

I'm using https://github.com/zeit/styled-jsx. And their css helper is supported by this project, but the more generic <style> tag isn't highlighted.

export default () => (
  <div className="root">
    <style jsx>{`
      .root {
        color: green;
      }
    `}</style>
  </div>
)
undeadcat commented 7 years ago

I've written a quick patch that configures injections in <style jsx>...</style> tags (meaningful part is styledJsxTag method).

I don't think it's a good idea to merge it into this plugin though. Simply for the reason that different frameworks will change their APIs at different times for and different reasons - leading to a plugin having a dependency on multiple different release cycles, higher chance of stuff breaking, etc. (if anyone has a different opinion, please share it!)

Feel free to do anything you like with the patch - fork the repo, apply the patch and use it for yourself / publish the result as a plugin :)

You could also use the method described in https://www.npmjs.com/package/styled-jsx#webstormidea to configure injections using //language comment

mxstbr commented 7 years ago

I don't think it's a good idea to merge it into this plugin though. Simply for the reason that different frameworks will change their APIs at different times for and different reasons - leading to a plugin having a dependency on multiple different release cycles, higher chance of stuff breaking, etc.

I agree, that should really be its own plugin.