mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not escape all quotes in triple quoted string
fixed PY-8926 Python: Conversion of docsting into recommended triple double-quoted form keeps doublequote at last position
This commit is contained in:
@@ -3,6 +3,7 @@ package com.jetbrains.python.inspections.quickfix;
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.python.PyBundle;
|
||||
@@ -46,8 +47,8 @@ public class ConvertDocstringQuickFix implements LocalQuickFix {
|
||||
else {
|
||||
content = content.length() == 1 ? "" : content.substring(1, content.length()-1);
|
||||
}
|
||||
|
||||
content = StringUtil.escapeQuotes(content);
|
||||
if (content.endsWith("\""))
|
||||
content = StringUtil.replaceSubstring(content, TextRange.create(content.length()-1, content.length()), "\\\"");
|
||||
|
||||
PyExpression newString = elementGenerator.createDocstring(prefix+"\"\"\"" + content + "\"\"\"").getExpression();
|
||||
expression.replace(newString);
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
def foo():
|
||||
"""bla \"blub\""""
|
||||
"""bla "blub\""""
|
||||
pass
|
||||
Reference in New Issue
Block a user