File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed
src/com/goide/codeInsight Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change 2020import com .goide .psi .GoType ;
2121import com .goide .psi .GoTypeOwner ;
2222import com .intellij .lang .ExpressionTypeProvider ;
23+ import com .intellij .openapi .util .Conditions ;
2324import com .intellij .openapi .util .text .StringUtil ;
2425import com .intellij .psi .PsiElement ;
25- import com .intellij .psi .util .PsiTreeUtil ;
26- import com .intellij .util .containers .ContainerUtil ;
26+ import com .intellij .psi .SyntaxTraverser ;
2727import org .jetbrains .annotations .NotNull ;
2828
2929import java .util .List ;
@@ -45,16 +45,6 @@ public String getErrorHint() {
4545 @ NotNull
4646 @ Override
4747 public List <GoTypeOwner > getExpressionsAt (@ NotNull PsiElement elementAt ) {
48- if (PsiTreeUtil .getParentOfType (elementAt , GoStatement .class ) == null ) {
49- return ContainerUtil .emptyList ();
50- }
51- List <GoTypeOwner > expressions = ContainerUtil .newArrayList ();
52- while (elementAt != null && !(elementAt instanceof GoStatement )) {
53- if (elementAt instanceof GoTypeOwner ) {
54- expressions .add ((GoTypeOwner )elementAt );
55- }
56- elementAt = elementAt .getParent ();
57- }
58- return expressions ;
48+ return SyntaxTraverser .psiApi ().parents (elementAt ).takeWhile (Conditions .notInstanceOf (GoStatement .class )).filter (GoTypeOwner .class ).toList ();
5949 }
6050}
You can’t perform that action at this time.
0 commit comments