@@ -5,7 +5,7 @@ import com.dmarcotte.handlebars.psi.*
55import com.dmarcotte.handlebars.psi.impl.HbOpenBlockMustacheImpl
66import com.dmarcotte.handlebars.psi.impl.HbStatementsImpl
77import com.emberjs.glint.GlintLanguageServiceProvider
8- import com.emberjs.gts.GtsFileViewProvider
8+ import com .emberjs.gts.GtsFileViewProvider
99import com.emberjs.psi.EmberNamedAttribute
1010import com.emberjs.psi.EmberNamedElement
1111import com.emberjs.refactoring.SimpleNodeFactory
@@ -269,7 +269,19 @@ class HbsLocalReference(private val leaf: PsiElement, val resolved: Any?) : HbRe
269269 return any
270270 }
271271
272+ if (any is JSRecordTypeImpl .PropertySignatureImpl ) {
273+ if (path.isEmpty()) {
274+ return any.jsType?.sourceElement
275+ }
276+ return resolveToJs(any.jsType, path)
277+ }
278+
272279 var jsType: JSType ? = null
280+
281+ if (any is JSType ) {
282+ jsType = any
283+ }
284+
273285 if (any is JSTypedEntity ) {
274286 jsType = any.jsType
275287 }
@@ -288,6 +300,11 @@ class HbsLocalReference(private val leaf: PsiElement, val resolved: Any?) : HbRe
288300 return resolveToJs(res, path, resolveIncomplete, recursionCounter + 1 )
289301 }
290302 }
303+ if (jsType is JSRecordTypeImpl && jsType.findPropertySignature(path.first()) != null ) {
304+ val elem = jsType.findPropertySignature(path.first())
305+ return resolveToJs(elem, path.subList(1 , max(path.lastIndex, 1 )), resolveIncomplete, recursionCounter + 1 )
306+ }
307+ jsType = EmberUtils .handleEmberProxyTypes(jsType) ? : jsType
291308 jsType = jsType.asRecordType()
292309 if (jsType is JSRecordTypeImpl ) {
293310 val elem = jsType.findPropertySignature(path.first())
@@ -363,7 +380,7 @@ class HbsLocalReference(private val leaf: PsiElement, val resolved: Any?) : HbRe
363380 if (closeMustache != null ) {
364381 val blockWrapper = closeMustache.parent
365382 val openId = PsiTreeUtil .collectElements(blockWrapper) { HbsPatterns .BLOCK_MUSTACHE_NAME_ID .accepts(it) }.firstOrNull()
366- val ref = openId?.reference ? : openId?.references?.firstOrNull()
383+ val ref = openId?.reference ? : openId?.references?.find { it.resolve() != null }
367384 return HbsLocalReference (element, ref?.resolve())
368385 }
369386
0 commit comments