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

Syntax highlighting for styled components in TSX broken #391

Open
james0r opened this issue Jan 30, 2024 · 2 comments
Open

Syntax highlighting for styled components in TSX broken #391

james0r opened this issue Jan 30, 2024 · 2 comments

Comments

@james0r
Copy link

james0r commented Jan 30, 2024

import React from 'react'
import styled, { css } from 'styled-components'

interface Props {
  background?: string
  text?: string
}

interface StyledSpanProps {
  background?: string
}

const StyledSpan = styled.span<StyledSpanProps>(({background}) => {
  const bg = background || 'white'

  return css`
    align-items: center;
    background-color: ${bg};
    border-radius: inherit;
    display: flex;
    height: 100%;
    justify-content: center;
    overflow: hidden;
    width: 100%;
  `
})

const ColorThemePreview = (props: Props) => {
  const {background, text} = props

  return (
    <StyledSpan background={background}>
      {text && <span style={{color: text, fontSize: '1.5em', fontWeight: 600}}>T</span>}
    </StyledSpan>
  )
}

export default ColorThemePreview

is displaying as
image

@Monokai
Copy link
Owner

Monokai commented Apr 10, 2024

I cannot reproduce this. In the latest VSCode with TypeScript JSX syntax, it displays correctly, especially everything that's uncolored (white) in your example. Can you confirm?

@james0r
Copy link
Author

james0r commented May 14, 2024

Not sure if it's related, but getting it again immediately after template strings. I noticed the same code on Github Dark is colored properly on the web so I switched to Github Dark within VSCode and it indeed displays correctly with Github Dark.

image

Here's the full file in a Gist with the correct coloring -> https://gist.github.com/james0r/82f610d8d153f2b022ff800b4febfa87

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

2 participants