File tree Expand file tree Collapse file tree 4 files changed +16
-7
lines changed
kotlin/com/intellij/StyledComponents Expand file tree Collapse file tree 4 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import com.intellij.openapi.util.text.StringUtil
88import com.intellij.patterns.ElementPattern
99import com.intellij.patterns.PatternCondition
1010import com.intellij.patterns.PlatformPatterns
11+ import com.intellij.psi.util.PsiTreeUtil
1112import com.intellij.util.ProcessingContext
1213import com.intellij.util.SmartList
1314import com.intellij.util.containers.ContainerUtil
@@ -51,7 +52,9 @@ fun getReferenceParts(jsReferenceExpression: JSReferenceExpression): List<String
5152 val name = ref.referenceName
5253 if (StringUtil .isEmptyOrSpaces(name)) return ContainerUtil .emptyList()
5354 nameParts.add(name)
54- ref = ref.qualifier as JSReferenceExpression ?
55+ val qualifier = ref.qualifier
56+ ref = qualifier as ? JSReferenceExpression
57+ ? : PsiTreeUtil .findChildOfType(qualifier, JSReferenceExpression ::class .java)
5558 }
5659 Collections .reverse(nameParts)
5760 return nameParts
Original file line number Diff line number Diff line change 11<idea-plugin >
22 <id >com.deadlock.scsyntax</id >
33 <name >Styled Components</name >
4- <version >1.0</version >
4+ <version >1.0.1 </version >
55 <
vendor email =
" [email protected] " url =
" http://www.saraya.io" >Kodehouse</
vendor >
66
77 <!-- Enable plugin for all products -->
1111 <depends >JavaScript</depends >
1212 <depends >org.jetbrains.plugins.less</depends >
1313 <description ><![CDATA[
14- Language Support For React Styled Components
15- https://github.com/styled-components/styled-components
14+ Language Support For <a href="https://github.com/styled-components/styled-components">React Styled Components</a>
1615 ]]> </description >
1716
1817 <change-notes ><![CDATA[
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ import com.intellij.util.containers.ContainerUtil
88import org.junit.Assert
99
1010class InjectionTest : LightCodeInsightFixtureTestCase () {
11-
1211 fun testSimpleComponent () {
1312 doTest(" const Title = styled.h1`\n " +
1413 " font-size: 1.5em;\n " +
@@ -25,8 +24,7 @@ class InjectionTest : LightCodeInsightFixtureTestCase() {
2524 " color: \$ {props => props.primary ? 'white' : 'palevioletred'};\n " +
2625 " " +
2726 " font-size: 1em;\n " +
28- " `;" ,
29- " div {\n " +
27+ " `;" ," div {\n " +
3028 " /* Adapt the colours based on primary prop */\n " +
3129 " background: EXTERNAL_FRAGMENT;\n " +
3230 " color: EXTERNAL_FRAGMENT;\n " +
@@ -47,6 +45,15 @@ class InjectionTest : LightCodeInsightFixtureTestCase() {
4745 " color: palevioletred;\n " +
4846 " }" )
4947 }
48+
49+ fun testComplexExpression2 () {
50+ doTest(" const ContactMenuIcon = ((styled(Icon)))" +
51+ " .attrs({ iconName: 'contact_card' })`\n " +
52+ " line-height: 0;\n " +
53+ " `" , " div {\n " +
54+ " line-height: 0;\n " +
55+ " }" )
56+ }
5057
5158 fun testKeyframes () {
5259 doTest(" const rotate360 = keyframes`\n " +
You can’t perform that action at this time.
0 commit comments