@@ -56,7 +56,7 @@ import com.intellij.psi.impl.file.PsiDirectoryImpl
5656import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReference
5757import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet
5858import com.intellij.psi.impl.source.tree.LeafPsiElement
59- import com.intellij.psi.search.ProjectScope
59+ import com.intellij.psi.templateLanguages.OuterLanguageElement
6060import com.intellij.psi.util.PsiTreeUtil
6161import com.intellij.psi.util.elementType
6262import com.intellij.psi.util.parents
@@ -148,6 +148,17 @@ class EmberUtils {
148148 }
149149
150150 val r = ref as PsiElement ? ? : exp
151+
152+ if (r is JSVariable ) {
153+ val v = r.children[1 ]
154+ val viewProvider = file.containingFile.viewProvider
155+ val ts = viewProvider.findElementAt(v.textOffset, JavaScriptSupportLoader .TYPESCRIPT )
156+ val js = viewProvider.findElementAt(v.textOffset, JavaScriptSupportLoader .ECMA_SCRIPT_6 )
157+ if (ts is OuterLanguageElement || js is OuterLanguageElement ) {
158+ return r
159+ }
160+ }
161+
151162 val func = r?.children?.find { it is JSCallExpression }
152163 if (func is JSCallExpression ) {
153164 return func
@@ -335,6 +346,11 @@ class EmberUtils {
335346 }
336347
337348 if (element is ES6ImportedBinding ) {
349+ var resolvedElement = (element).multiResolve(true )[0 ]?.element
350+ resolvedElement = followReferences(resolvedElement)
351+ if (resolvedElement != null ) {
352+ return resolvedElement
353+ }
338354 var ref: PsiReference ? = element.declaration?.fromClause?.references?.findLast { it is EmberJSModuleReference && it.rangeInElement.endOffset == it.element.textLength - 1 && it.resolve() != null } as EmberJSModuleReference ?
339355 if (ref == null ) {
340356 ref = element.declaration?.fromClause?.references?.findLast { it is JSFileModuleReference }
0 commit comments