TextRange (@Nullable PsiElement element) { if (element == null) return null; IElementType elementType = element.getNode().getElementType(); if (!GroovyTokenSets.STRING_LITERALS.contains(elementType)) return null; String text = element.getText(); String startQuote = getStartQuote(text); String endQuote = getEndQuote(text.substring(startQuote.length())); return new TextRange(startQuote.length(), element.getTextLength() - endQuote.length()); }