Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with syntax highlight when using css #23

Open
present-g opened this issue Mar 20, 2024 · 0 comments
Open

Problems with syntax highlight when using css #23

present-g opened this issue Mar 20, 2024 · 0 comments

Comments

@present-g
Copy link

When using css, the syntax highlighting breaks.

Example code:

const StylesWithCss = css`
  margin: 0;
  background: red;

  & > * {
    /* valid highlight */
    margin: 10px;
  }
`;

const StylesWithTopLevel = styled.div<{ $margin?: string; $isActive: boolean | undefined }>(
  ({ $margin, $isActive }) => css`
    display: flex;
    flex-direction: column;
    margin: ${$margin};
    width: 100%;
    overflow: hidden;
    position: relative;

    ${$isActive
      ? css`
          margin: 0;
          background: red;
        `
      : ''}
  `
);

const StylesWithCondition = styled.div<{ $isActive: boolean | undefined }>`
  /* valid highlight */
  overflow-x: auto;
  scroll-snap-type: x mandatory;

  ${({ $isActive }) =>
    $isActive
      ? css`
          overflow-x: unset;
          scroll-snap-type: unset;
        `
      : ''}
`;

Screenshot from VSCode:

Screenshot from VSCode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant