Finding PsiTypeElement from PsiReferenceExpression
Hi, I was wondering if there is an easy way to retrieve a PsiTypeElement from PsiReferenceExpression class.
In the example below I would like to retrieve the type of the variable t in the for loop having an instance of the object of PsiReferenceExpression.
And I would like to get PsiTypeElement, mainly it's value which is "int".
}
Thanks in advance.
请先登录再写评论。
The first thing I would suggest is to install the plugin PsiViewer from the plugin repositoiry.



I show the psi tree for the variable "files"
In the attribute inspector, I can see the type property is exposed by the PsiReferenceExpression.
Thank you Jon, it was very helpful