List<DataLanguageBlockWrapper> (@NotNull List<DataLanguageBlockWrapper> list, @NotNull TextRange textRange) { int i = 0; while (i < list.size()) { final DataLanguageBlockWrapper wrapper = list.get(i); final TextRange range = wrapper.getTextRange(); if (textRange.contains(range)) { i++; } else if (range.intersectsStrict(textRange)) { list.remove(i); list.addAll(i, buildChildWrappers(wrapper.getOriginal())); } else { list.remove(i); } } return list; }