boolean (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { if (!(file instanceof PyFile)) { return false; } final int caretOffset = editor.getCaretModel().getOffset(); final PyStringLiteralExpression pyString = PsiTreeUtil.getParentOfType(file.findElementAt(caretOffset), PyStringLiteralExpression.class); if (pyString != null) { final PyDocStringOwner docStringOwner = PsiTreeUtil.getParentOfType(pyString, PyDocStringOwner.class); if (docStringOwner != null) { if (docStringOwner.getDocStringExpression() == pyString) return false; } for (StringNodeInfo info : extractStringNodesInfo(pyString)) { if (info.isTripleQuoted() && info.isTerminated() && info.getNode().getTextRange().contains(caretOffset)) { return true; } } } return false; }