Skip to content

Commit 70ac709

Browse files
committed
fix toc named block completions and refs
1 parent d4fbbeb commit 70ac709

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/main/kotlin/com/emberjs/utils/EmberUtils.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ import com.dmarcotte.handlebars.parsing.HbTokenTypes
66
import com.dmarcotte.handlebars.psi.*
77
import com.dmarcotte.handlebars.psi.impl.HbPathImpl
88
import com.emberjs.cli.EmberCliFrameworkDetector
9+
import com.emberjs.gts.GjsLanguage
910
import com.emberjs.gts.GtsElementTypes
1011
import com.emberjs.gts.GtsFile
1112
import com.emberjs.gts.GtsFileViewProvider
13+
import com.emberjs.gts.GtsLanguage
1214
import com.emberjs.hbs.*
1315
import com.emberjs.index.EmberNameIndex
1416
import com.emberjs.navigation.EmberGotoRelatedProvider
@@ -844,6 +846,12 @@ class EmberUtils {
844846
}
845847
}
846848
}
849+
850+
if (cls is TypeScriptVariable) {
851+
jsTemplate = f.containingFile.viewProvider.findElementAt(cls.children[1].textOffset, JavaScriptSupportLoader.TYPESCRIPT)
852+
} else if (cls is JSVariable) {
853+
jsTemplate = f.containingFile.viewProvider.findElementAt(cls.children[1].textOffset, JavaScriptSupportLoader.ECMA_SCRIPT_6)
854+
}
847855
}
848856

849857
template = dir?.findFile("$name.hbs") ?: dir?.findFile("template.hbs") ?: dir?.findFile("template.ts") ?: dir?.findFile("template.js")
@@ -936,6 +944,13 @@ class EmberUtils {
936944
}
937945
}
938946
}
947+
if (cls is TypeScriptVariable) {
948+
if (cls.jsType.toString().startsWith("TOC<") || cls.jsType.toString().startsWith("TemplateOnlyComponent<")) {
949+
val arg = (cls.jsType as JSGenericTypeImpl).arguments[0]
950+
blocks = arg.asRecordType().properties.find { it.memberName == "Blocks" }
951+
args = arg.asRecordType().properties.find { it.memberName == "Args" }
952+
}
953+
}
939954
if (blocks != null) {
940955
val yields = blocks?.jsType?.asRecordType()?.properties
941956
yields?.forEach {

0 commit comments

Comments
 (0)