diff options
| author | Steve Occhipinti <dev@stevenocchipinti.com> | 2021-07-25 15:35:17 +1000 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2021-11-28 15:02:55 +0100 |
| commit | 058e05031579b4a46afb07b9d18704b806878ae6 (patch) | |
| tree | 5c2c6184ef58a48e84b939ddaaf315de655d9865 /queries/ecma/injections.scm | |
| parent | b5d05aaac8dac06b05c5d7f2d445576181d38961 (diff) | |
Add a basic styled-components injection
I've never written this sort of code before but I was able to get this to work
with the help of copy and paste and using nvim-treesitter/playground.
I had a hard time trying to understand how to indent this style of code so I let
vim do it with `=` and 2 spaces seems to match other files I looked at.
This works for a basic example, like this:
```
const Layout = styled.div`
position: absolute;
inset: 0;
display: grid;
grid-template-rows: 100px 1fr 3rem;
`
```
Diffstat (limited to 'queries/ecma/injections.scm')
| -rw-r--r-- | queries/ecma/injections.scm | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/queries/ecma/injections.scm b/queries/ecma/injections.scm index 937ef08d..52d0d242 100644 --- a/queries/ecma/injections.scm +++ b/queries/ecma/injections.scm @@ -2,20 +2,25 @@ (comment) @comment (call_expression - function: ((identifier) @language) - arguments: ((template_string) @content - (#offset! @content 0 1 0 -1))) + function: ((identifier) @language) + arguments: ((template_string) @content + (#offset! @content 0 1 0 -1))) (call_expression - function: ((identifier) @_name - (#eq? @_name "gql")) - arguments: ((template_string) @graphql - (#offset! @graphql 0 1 0 -1))) + function: ((identifier) @_name + (#eq? @_name "gql")) + arguments: ((template_string) @graphql + (#offset! @graphql 0 1 0 -1))) (call_expression - function: ((identifier) @_name - (#eq? @_name "hbs")) - arguments: ((template_string) @glimmer - (#offset! @glimmer 0 1 0 -1))) + function: ((identifier) @_name + (#eq? @_name "hbs")) + arguments: ((template_string) @glimmer + (#offset! @glimmer 0 1 0 -1))) + +(call_expression + function: (member_expression + object: (identifier) @_name (#eq? @_name "styled")) + arguments: ((template_string) @css (#offset! @css 0 1 0 -1))) (regex_pattern) @regex |
