borela / naomi

Sublime Text enhanced syntax highlighting for JavaScript ES6/ES7/ES2015/ES2016/ES2017+, Babel, FlowType, React JSX, Styled Components, HTML5, SCSS3, PHP 7, phpDoc, PHPUnit, MQL4. Basic: Git config files.
Other
557 stars 20 forks source link

Multiple referenced styled-components selectors break highlighting for the rest of the file #240

Open bostrom opened 4 years ago

bostrom commented 4 years ago

Referencing multiple child styled-components on the same row breaks syntax highlighting for the rest of the file.

image

Example:

const StyledSection = styled.div`
  background-color: ${({ theme }) => theme.colors.primary};
  text-align: center;
  ${P}, ${H2}, ${H3} {
    color: ${({ theme }) => theme.colors.white};
  }
`;
const HeaderIcon = styled.div`
  display: block;
  align-items: center;
  ${H3} {
    @media (min-width: ${({ theme }) => theme.breakpoints.tablet}) {
      font-size: 1.1rem;
    }
    @media (min-width: ${({ theme }) => theme.breakpoints.desktop}) {
      font-size: 1.5rem;
    }
    font-size: 1.6875rem;
    margin: 0;
  }
`;
bostrom commented 4 years ago

Apparently the same applies for using +.

const StyledP = styled.p`
  text-align: center;
  + ${P} {
    color: ${({ theme }) => theme.colors.white};
  }
`;
joshuapaling commented 4 years ago

Related issue with styled components and specific nesting issues:

Screen Shot 2019-11-15 at 10 32 37 am

Screen Shot 2019-11-15 at 10 32 47 am