styled-components / vim-styled-components

Vim bundle for http://styled-components.com based javascript files.
300 stars 24 forks source link

styled-jsx resolve handling #67

Closed Simounet closed 5 years ago

Simounet commented 5 years ago

Hi there, I know that this is a bit out of scope but can I add the expected CSS syntax for this code?

const foo = css.resolve`
  .bar {
    font-size: 1.3rem;
  }
`;

It comes from styled-jsx.

Have a nice day.

fleischie commented 5 years ago

Hey @Simounet ,

I don't see why this would be out of scope? This plugin already supports non-styled-components APIs (e.g. diet-cola (which is now archived I just saw, also I don't use it, so maybe support is not the best. :stuck_out_tongue_winking_eye: ).

So, if you want to try to add support on your own, go for it. If you need help, or would rather have me add it, just let me know, and I will see what I can do. :smile:

Simounet commented 5 years ago

Thanks for your reply. I'm trying to edit syn region from after/syntax/javascript.vim but I'm not sure about it.

fleischie commented 5 years ago

I would suggest looking at how jsTaggedTemplate is overloaded in after/syntax/javascript.vim. But also make sure not only to highlight on .resolve, and .global, as these can be used from other APIs (and of course self-defined tagged template functions).

But it would be a first step, to just add .resolve, and .global to jsTaggedTemplate. If you need further help, let me know.

:+1: