vscode-styled-components icon indicating copy to clipboard operation
vscode-styled-components copied to clipboard

Doesn't work if more lines after "styled"

Open adamzalesak opened this issue 3 years ago • 3 comments

image

adamzalesak avatar Oct 07 '21 07:10 adamzalesak

@adamzalesak Can you follow the template and include the code with the screenshot? The issue is because ) is on a new line.

I think we will need a new rule where /styled($/ is at the end of a line, followed by typescript arguments, followed by )` followed by styles followed by `

Feel free to contribute, I can help along the way

jasonwilliams avatar Oct 07 '21 09:10 jasonwilliams

Also doesn't work if styled() is wrapping an inline component (that likely takes more than 1 line):

const StyledComponent = styled(() => {
    return <div>Hello world!</div>;
})`
    color: red;
`;
image

Zodiase avatar Nov 25 '21 06:11 Zodiase

I believe this is the same issue.

It's the same issue if typed "properties" extend across multiple lines:

const InputWrapper = styled.div<{
  disabled: boolean;
}>`
  display: flex;
`;

Edit: This is already covered in the contribute info file: https://github.com/styled-components/vscode-styled-components/blob/master/CONTRIBUTING.md#a-line-break-seems-to-break-the-syntax-highlighting

antonstjernquist avatar Jan 11 '22 13:01 antonstjernquist