List<TextRange> () { final ASTNode firstContentChild = myHost.getFirstContentNode(); if (firstContentChild == null) { return Collections.emptyList(); } final int myStart = myHost.getTextRange().getStartOffset(); final List<TextRange> result = new ArrayList<>(); final int indent = myHost.locateIndent(); final ASTNode firstEol = TreeUtil.findSibling(firstContentChild, YAMLElementTypes.EOL_ELEMENTS); if (firstEol == null) { return Collections.emptyList(); } int thisLineStart = firstEol.getStartOffset() + 1; for (ASTNode child = firstEol.getTreeNext(); child != null; child = child.getTreeNext()) { final IElementType childType = child.getElementType(); final TextRange childRange = child.getTextRange(); if (childType == YAMLTokenTypes.INDENT && isEol(child.getTreePrev())) { thisLineStart = child.getStartOffset() + Math.min(indent, child.getTextLength()); } else if (childType == YAMLTokenTypes.SCALAR_EOL) { if (thisLineStart != -1) { int endOffset = shouldIncludeEolInRange(child) ? child.getTextRange().getEndOffset() : child.getStartOffset(); result.add(TextRange.create(thisLineStart, endOffset).shiftRight(-myStart)); } thisLineStart = child.getStartOffset() + 1; } else { if (isEol(child.getTreeNext())) { if (thisLineStart == -1) { Logger.getInstance(YAMLBlockScalarTextEvaluator.class).warn("thisLineStart == -1: '" + myHost.getText() + "'", new Throwable()); continue; } int endOffset = shouldIncludeEolInRange(child) ? child.getTreeNext().getTextRange().getEndOffset() : childRange.getEndOffset(); result.add(TextRange.create(thisLineStart, endOffset).shiftRight(-myStart)); thisLineStart = -1; } } } if (thisLineStart != -1) { result.add(TextRange.create(thisLineStart, myHost.getTextRange().getEndOffset()).shiftRight(-myStart)); } ChompingIndicator chomping = getChompingIndicator(); if (chomping == ChompingIndicator.KEEP) { return result; } final int lastNonEmpty = ContainerUtil.lastIndexOf(result, range -> range.getLength() != 0); return lastNonEmpty == -1 ? Collections.emptyList() : result.subList(0, lastNonEmpty + 1); }