TextRange (@NotNull final PyStringLiteralExpression element, @NotNull final PyStringFormatParser.SubstitutionChunk chunk) { final TextRange textRange = chunk.getTextRange(); if (chunk.getMappingKey() != null) { final int start = textRange.getStartOffset() + chunk.getTextRange().substring(element.getText()).indexOf(chunk.getMappingKey()); return TextRange.from(start, chunk.getMappingKey().length()); } return textRange; }