Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Allow tagged template injections to accept function parameters #639

Merged
merged 1 commit into from
Feb 7, 2019

Conversation

daviwil
Copy link
Contributor

@daviwil daviwil commented Feb 7, 2019

Description of the Change

This change fixes #634 which reports that the Tree-Sitter JavaScript grammar does not correctly highlight tagged template injections which have function parameters, such as those used in the Styled Components library. The fix enables tagged template injections to be highlighted correctly when the template invocation includes function arguments.

Before

styled_before

After

styled_fixed

Alternate Designs

This is the simplest design that enables any tagged template literal to be called with arguments and then have a language injection to be applied.

Benefits

CSS syntax inside of styled template literals with function arguments (styled(Button)) is now highlighted correctly.

Possible Drawbacks

None

Applicable Issues

Fixes #634

This change fixes #634 which reports that the Tree-Sitter JavaScript grammar
does not correctly highlight tagged template injections which have function
parameters, such as those used in the Styled Components library.  The fix
enables tagged template injections to be highlighted correctly when the template
invocation includes function arguments.
@daviwil daviwil merged commit 0893d74 into master Feb 7, 2019
@daviwil daviwil deleted the dw-fix-styled-call-injection branch February 7, 2019 01:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CSS grammar not injected for custom styled-components
1 participant