Closed zhenzhenChange closed 1 year ago
By default this extension activates on .tsx
and .jsx
, it's good practise to use styled components in tsx
and jsx
files so your IDE knows which mode to be in.
If you want to force this extension to be on you'll need to go to the bottom right of your IDE and set TypeScript JSX
as your language.
I haven't actually switched the .ts
file to .tsx
mode yet, but there are hints in the .ts
file, I mean just the colours without the preview hints.
We cannot do that, because if we do that people would have colour pickers showing up all over the place whenever they reference a colour in a .ts file (even just the word “blue”).
Sadly the only option if you want this feature is to move to .tsx which is what most of our users have done already.
The other alternative is to copy the great work @RJWadley did, which is to detect if you’re within a CSS block and only have the colour picker load there. So taking this https://github.com/styled-components/vscode-styled-components/pull/375/files and applying into the colorpicker provider. Which would require a PR. Then maybe we could relax the rules around .ts usage.
IntelliJ IDEA is able to provide color previews for styled components in .ts files. I was hoping to do the same in VS Code through this extension, but unfortunately this is still an issue.
Describe the bug (including copyable syntax)
In .ts file extensions, there is no color preview.
Screenshot
To Reproduce
None.
Expected behavior
Can you add support for
.ts
? Or can a configuration be opened for users to add it manually?Build environment (please complete the following information):
Extensions
Additional context
None.