TextRange (@NotNull PsiElement token) { final ASTNode node = token.getNode(); if (node == null) return null; final IElementType tokenType = node.getElementType(); if (GroovyTokenSets.STRING_LITERALS.contains(tokenType)) { final String text = token.getText(); if (text == null) return null; return GroovyStringLiteralManipulator.getLiteralRange(text).shiftRight(node.getStartOffset()); } if (tokenType == SLASHY_CONTENT || tokenType == DOLLAR_SLASHY_CONTENT) { return token.getTextRange(); } return null; }