michaelgmcd / vscode-language-babel

VSCode syntax highlighting for today's JavaScript
https://marketplace.visualstudio.com/items?itemName=mgmcdermott.vscode-language-babel
MIT License
131 stars 17 forks source link

Syntax highlighting breaks after using styled-components css helper in TypeScript #73

Closed loqusion closed 4 years ago

loqusion commented 4 years ago

Screenshot of Current Behavior

image

It works when we remove the generic tag:

image

Interestingly, it also works with styled.(tag)<type>:

image

Sample Code to Reproduce

const StyledButtonPlay = css<ButtonProps>`
  width: 50px;
  height: 50px;
  border-width: 50px;

  &:hover {
    border-left-color: white;
    cursor: pointer;
  }
`;

const StyledButtonPause = css<ButtonProps>`
  &:hover {
    border-color: white;
  }
`;

export const StyledButton = styled.button<ButtonProps>`
  box-sizing: border-box;
  background-color: transparent;
  border-style: solid;
  border-color: transparent transparent transparent #282a2d;

  ${(props) => (
    props.paused
      ? StyledButtonPlay
      : StyledButtonPause
  )}
`;

(Property interpolations were used in the original code for StyledButtonPlay, but they were removed here for brevity. The generic tag is required for the original code to work in TypeScript.)

michaelgmcd commented 4 years ago

Unfortunately @Flandre-X, the syntax highlighting provided by this plugin is only available for JavaScript (.js, .jsx) files. There are several reasons for not supporting .ts/.tsx. The first that come to mind are:

I would give vscode-styled-components a whirl if you haven't already.