Skip to content

Commit

Permalink
Improve highlighting of styled components with generics.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thom1729 committed Nov 10, 2021
1 parent 6b866a4 commit d28ce3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ contexts:
scope: variable.function.js
pop: true

- match: '{{non_reserved_identifier}}(?=\s*`)'
# If we see <, assume it's a template.
# Not perfect, but should be correct most of the time.
- match: '{{non_reserved_identifier}}(?=\s*[`<])'
scope: variable.function.tagged-template.js
pop: true

Expand Down
3 changes: 3 additions & 0 deletions tests/syntax_test_suites/templates/styled_components.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ keyframes`
color: red;
}
`;

styled.span<{}>`color: red`;
// ^^^^ variable.function.tagged-template

0 comments on commit d28ce3a

Please sign in to comment.