Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Syntax highlighting not applied for nested css-template literals if using a styled() function to generate component instead of styled.div #118

@AasmundEndresen

Description

@AasmundEndresen

I'm using vue-styled-components, but this also applies to React.

Syntax highlighting is only applied to nested template literals if using the styled.[node] syntax.
In many cases its preferrable to use the constructor syntax, such as for vue you need this syntax to pass down props.

image

Or in React if using the styled constructor to style a functional component upon export.

const MyComponent = () => <div className={className}><p>Some Component</p></div>;

export default styled(MyComponent)`
  ${my_style}
`;

There are also many other cases where this constructor syntax is used such as when using withComponent, attrs, etc... The problem is that in these cases syntax highlighting is not applied to the nested css callback as shown in the image above. (This works fine in the normal styled syntax.)

image

The current workaround for me is to write my css in a css`` function and either apply it as a variable, or move it inside the non-highlighted code after verifying there is no syntax errors.

Its not making the extension unusable, but it would be immensely helpful if syntax highlighting worked on the nested level as well...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions