styled-components / vim-styled-components

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

Parentheses inside attrs constructor break highlighting #33

Closed simlrh closed 6 years ago

simlrh commented 6 years ago

This affects #30.

import styled from 'styled-components';

function getPadding() {
  return '1rem';
}

const Div = styled.div.attrs({
  padding: '1rem',
})`
  margin: 0;
  padding: ${(props) => props.padding};
`;

const P = styled.p.attrs({
  padding: getPadding(),
})`
  margin: 0;
  padding: ${(props) => props.padding};
`;

Attempting to use dynamic prop generation fails if you use parentheses inside the attrs constructor. Here Div works but P doesn't.

fleischie commented 6 years ago

Thanks @simlrh for this issue. I will look into it, when I find the time.

fleischie commented 6 years ago

Should be fixed, when #30 is merged (ETA: Beginning of next week.)