Skip to content

Commit

Permalink
Improve yats.vim support
Browse files Browse the repository at this point in the history
- Extend `typescriptIdentifierName` to contain keywords that trigger
  styled definitions as their next group specifically.
- Add issue example file to investigate this issue.
  • Loading branch information
fleischie committed Feb 12, 2019
1 parent d87c6b3 commit 64e58a8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions after/syntax/javascript.vim
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ syn cluster javascriptExpression
\ add=styledPrefix,jsFuncCall,javascriptTagRefStyledPrefix
syn cluster javascriptAfterIdentifier add=styledPrefix,jsFuncCall

""" yats specific extensions
" extend typescriptIdentifierName to allow styledDefinitions in their
" tagged templates
syn match typescriptIdentifierName extend
\ "\<css\>\|\<keyframes\>\|\<injectGlobal\>\|\<fontFace\>\|\<createGlobalStyle\>"
\ nextgroup=styledDefinition

" color the custom highlight elements
hi def link cssCustomKeyFrameSelector Constant
Expand Down
15 changes: 15 additions & 0 deletions examples/issue-56.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const dynamicStyle = (props: any) => css`
color: ${props.color};
padding: 10px;
`;

css`
padding: 10px;
`;

const exampleCSS = css`
display: flex;
background-color: ${color('primary')};
align-items: center;
padding: ${spacing('tiny')} 0;
`;

0 comments on commit 64e58a8

Please sign in to comment.