Skip to content

Commit 9070f50

Browse files
committed
add 'div {' prefix and '}' suffix to css`` for most common pattern
1 parent 9ce1309 commit 9070f50

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/main/kotlin/com/intellij/StyledComponents/StyledComponentsInjector.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class StyledComponentsInjector : MultiHostInjector {
2222
PlatformPatterns.psiElement(JSExpression::class.java)
2323
.withFirstChild(styledPattern))), "div {", "}"),
2424
PlaceInfo(taggedTemplate(withReferenceName("extend")), "div {", "}"),
25-
PlaceInfo(taggedTemplate("css")),
25+
PlaceInfo(taggedTemplate("css"), "div {", "}"),
2626
PlaceInfo(taggedTemplate("injectGlobal")),
2727
PlaceInfo(taggedTemplate("keyframes"), "@keyframes foo {", "}")
2828
)

src/main/resources/META-INF/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<idea-plugin>
22
<id>com.deadlock.scsyntax</id>
33
<name>Styled Components</name>
4-
<version>1.0.1</version>
4+
<version>1.0.3</version>
55
<vendor email="[email protected]" url="http://www.saraya.io">Kodehouse</vendor>
66

77
<!-- Enable plugin for all products -->

src/test/InjectionTest.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ import com.intellij.util.containers.ContainerUtil
88
import org.junit.Assert
99

1010
class InjectionTest : LightCodeInsightFixtureTestCase() {
11+
fun testCss() {
12+
doTest("let css = css`\n" +
13+
" color:red;\n" +
14+
" width:100px;\n" +
15+
" height:100px;`", "div {\n" +
16+
" color:red;\n" +
17+
" width:100px;\n" +
18+
" height:100px;}")
19+
}
20+
1121
fun testSimpleComponent() {
1222
doTest("const Title = styled.h1`\n" +
1323
" font-size: 1.5em;\n" +

0 commit comments

Comments
 (0)