vscode-styled-components icon indicating copy to clipboard operation
vscode-styled-components copied to clipboard

[Feature Request] - Syntax highlighting for custom tags

Open connebs opened this issue 4 years ago • 3 comments

Basically an extension of this issue: https://github.com/styled-components/vscode-styled-components/issues/224

Apparently the intellisense is with the TS compiler and can be configured there, but the syntax highlighting is handled by this plugin so setting custom tags in tsconfig.json has no effect on the syntax highlighting.

Is there a reason for this? Can we not just add a VS Code setting or whatever that allows you to set custom tags? Seems like a much better way of doing it than hard-coding tag names for every styled-components-style library under the sun (there are so many now!)

connebs avatar Jun 03 '21 20:06 connebs

@acnebs it may be possible with https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide

would you be interested in investigating that? It won’t be something I’ll ever get round to doing

jasonwilliams avatar Jun 04 '21 07:06 jasonwilliams

@acnebs It looks like you could just modify the first part of this regex, you can see where it spells out "styled": image https://github.com/styled-components/vscode-styled-components/blob/master/syntaxes/styled-components.json

Should be easy to generate that portion of the regex from a list of keywords but not sure how much work making a settings page that writes to this JSON is.

scornwell-meta avatar Jun 11 '21 20:06 scornwell-meta

@acnebs It looks like you could just modify the first part of this regex, you can see where it spells out "styled": image https://github.com/styled-components/vscode-styled-components/blob/master/syntaxes/styled-components.json

Should be easy to generate that portion of the regex from a list of keywords but not sure how much work making a settings page that writes to this JSON is.

That is a static file which is written and compiled ahead of time. It can’t be modified on the fly depending on the users settings. So that idea won’t work

jasonwilliams avatar Jun 13 '21 08:06 jasonwilliams