@@ -6,9 +6,11 @@ import com.dmarcotte.handlebars.parsing.HbTokenTypes
66import com.dmarcotte.handlebars.psi.*
77import com.dmarcotte.handlebars.psi.impl.HbPathImpl
88import com.emberjs.cli.EmberCliFrameworkDetector
9+ import com.emberjs.gts.GjsLanguage
910import com.emberjs.gts.GtsElementTypes
1011import com.emberjs.gts.GtsFile
1112import com.emberjs.gts.GtsFileViewProvider
13+ import com.emberjs.gts.GtsLanguage
1214import com.emberjs.hbs.*
1315import com.emberjs.index.EmberNameIndex
1416import com.emberjs.navigation.EmberGotoRelatedProvider
@@ -285,6 +287,10 @@ class EmberUtils {
285287 fun findComponentArgsType (element : JSElement ): JSRecordType ? {
286288 var cls: PsiElement ? = element
287289 if (cls is TypeScriptVariable ) {
290+ if (cls.jsType.toString().startsWith(" TOC<" ) || cls.jsType.toString().startsWith(" TemplateOnlyComponent<" )) {
291+ val arg = (cls.jsType as JSGenericTypeImpl ).arguments[0 ]
292+ return arg.asRecordType().properties.find { it.memberName == " Args" }?.jsType?.asRecordType()
293+ }
288294 return cls.jsType?.asRecordType()?.callSignatures?.firstOrNull()?.returnType?.asRecordType()?.properties?.find { it.memberName == " Context" }?.jsType?.asRecordType()?.properties?.find { it.memberName == " args" }?.jsType?.asRecordType()
289295 }
290296 if (cls is TypeScriptAsExpression ) {
@@ -840,6 +846,12 @@ class EmberUtils {
840846 }
841847 }
842848 }
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+ }
843855 }
844856
845857 template = dir?.findFile(" $name .hbs" ) ? : dir?.findFile(" template.hbs" ) ? : dir?.findFile(" template.ts" ) ? : dir?.findFile(" template.js" )
@@ -932,6 +944,13 @@ class EmberUtils {
932944 }
933945 }
934946 }
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+ }
935954 if (blocks != null ) {
936955 val yields = blocks?.jsType?.asRecordType()?.properties
937956 yields?.forEach {
0 commit comments