TextMateScope (TextMateElementType tokenType) { TextMateScope current = tokenType.getScope(); List<CharSequence> trail = new ArrayList<>(); while (current != null) { CharSequence scopeName = current.getScopeName(); if (scopeName != null && Strings.contains(scopeName, ".embedded.")) { TextMateScope result = TextMateScope.EMPTY; for (int i = trail.size() - 1; i >= 0; i--) { result = result.add(trail.get(i)); } return result; } trail.add(scopeName); current = current.getParent(); } return tokenType.getScope(); }