PsiElement (PsiFile file, Editor editor) { PsiElement element = file.findElementAt(editor.getCaretModel().getCurrentCaret().getOffset()); StringLiteralExpression stringLiteral = PsiTreeUtil.getParentOfType(element, StringLiteralExpression.class, false, PyFStringFragment.class); if (stringLiteral instanceof PyStringLiteralExpression && ((PyStringLiteralExpression)stringLiteral).isInterpolated()) { return null; } return stringLiteral; }