List<TextRange> () { final ASTNode firstContentNode = myHost.getFirstContentNode(); if (firstContentNode == null) { return Collections.emptyList(); } List<TextRange> result = new ArrayList<>(); TextRange contentRange = TextRange.create(firstContentNode.getStartOffset(), myHost.getTextRange().getEndOffset()) .shiftRight(-myHost.getTextRange().getStartOffset()); final List<String> lines = StringUtil.split(contentRange.substring(myHost.getText()), "\n", true, false); // First line has opening quote int cumulativeOffset = contentRange.getStartOffset(); for (int i = 0; i < lines.size(); ++i) { final String line = lines.get(i); int lineStart = 0; int lineEnd = line.length(); if (i == 0) { lineStart++; } else { while (lineStart < line.length() && YAMLGrammarCharUtil.isSpaceLike(line.charAt(lineStart))) { lineStart++; } } if (i == lines.size() - 1) { // Last line has closing quote lineEnd--; } else { while (lineEnd > lineStart && YAMLGrammarCharUtil.isSpaceLike(line.charAt(lineEnd - 1))) { lineEnd--; } } result.add(TextRange.create(lineStart, lineEnd).shiftRight(cumulativeOffset)); cumulativeOffset += line.length() + 1; } return result; }