List<PsiElement> (PsiElement fragment) { PsiElement element = fragment.getFirstChild(); final List<PsiElement> result = new SmartList<>(); while (element != null) { if (!(element instanceof PsiWhiteSpace)) { result.add(element); } element = element.getNextSibling(); } return result; }