List<TextRange> (PsiElement e, int cursorOffset) { PsiElement nextCommaSibling = e.getNextSibling(); if (nextCommaSibling != null) { ASTNode node = nextCommaSibling.getNode(); if (node != null) { IElementType commaType = node.getElementType(); if (commaType == PyTokenTypes.COMMA) { PsiElement nextSpaceSibling = nextCommaSibling.getNextSibling(); if (nextSpaceSibling != null) { TextRange textRange = e.getTextRange(); TextRange offsetRange; if (nextSpaceSibling instanceof PsiWhiteSpace) { offsetRange = new TextRange(textRange.getStartOffset(), textRange.getEndOffset() + 2); } else { offsetRange = new TextRange(textRange.getStartOffset(), textRange.getEndOffset() + 1); } if (offsetRange.contains(cursorOffset) && offsetRange.getLength() > 1) { return Collections.singletonList(offsetRange); } } } } } return Collections.emptyList(); }