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

Feature request: snippets inside of tagged template literals #46792

Closed
hollandThomas opened this issue Mar 28, 2018 · 2 comments
Assignees

Comments

@hollandThomas
Copy link

@hollandThomas hollandThomas commented Mar 28, 2018

I'd like to suggest a feature, if possible. When working with styled-components, you often find yourself writing things like ${props => props.theme.colors.gray.dark}; inside of a tagged template literal kinda like this:

const Wrapper = styled.div`
  color: ${props => props.theme.colors.gray.dark};
`;

For that I made a snippet. Unfortunately one cannot seem to invoke snippets inside of tagged templates or any string for that matter.

Is adding a feature that allows for working with snippets inside of strings/stringish things like tagged template literals possible? Or would that violate the expected behavior for pressing tab with the cursor being inside of a sting?

Thanks for looking into this!

@jrieken

This comment has been minimized.

Copy link
Member

@jrieken jrieken commented Mar 28, 2018

Please share the snippet and the language the snippet is configured for. Also use F1 > Inspect TM Scopes to see what language is used inside the tagged string

@hollandThomas

This comment has been minimized.

Copy link
Author

@hollandThomas hollandThomas commented Mar 28, 2018

Thanks the fast reply. You are right. I configured the snippet for Babel JavaScript but it needs to be configured for styled-css. For completion and anyone interested, this is the snippet:

"theme": {
    "prefix": "thm",
    "body": [
        "${props => props.theme.${1:property}};"
    ],
    "description": "Styled Components theme selector"
},
@vscodebot vscodebot bot locked and limited conversation to collaborators May 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants
You can’t perform that action at this time.