mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
Fix for unicode escapes: use getText() instead of getStringValue()
This commit is contained in:
@@ -67,7 +67,7 @@ public class PyAddSpecifierToFormatQuickFix implements LocalQuickFix {
|
||||
final PyExpression leftExpression = expression.getLeftExpression();
|
||||
if (leftExpression instanceof PyStringLiteralExpression) {
|
||||
final List<PyStringFormatParser.SubstitutionChunk> chunks =
|
||||
filterSubstitutions(parsePercentFormat(((PyStringLiteralExpression)leftExpression).getStringValue()));
|
||||
filterSubstitutions(parsePercentFormat(leftExpression.getText()));
|
||||
PyExpression[] elements;
|
||||
if (rightExpression instanceof PyTupleExpression) {
|
||||
elements = ((PyTupleExpression)rightExpression).getElements();
|
||||
@@ -76,7 +76,7 @@ public class PyAddSpecifierToFormatQuickFix implements LocalQuickFix {
|
||||
elements = new PyExpression[]{rightExpression};
|
||||
}
|
||||
|
||||
int shift = 2;
|
||||
int shift = 1;
|
||||
for (int i = 0; i < chunks.size(); i++) {
|
||||
final PyStringFormatParser.PercentSubstitutionChunk chunk = PyUtil.as(chunks.get(i), PyStringFormatParser.PercentSubstitutionChunk.class);
|
||||
if (chunk != null) {
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
s = <warning descr="Format specifier character missing">u"\N{LATIN SMALL LETTER B}%s\N{NUMBER SIGN}\
|
||||
%\N{LATIN SMALL <caret>LETTER B}"</warning> % ("a", "b")
|
||||
@@ -0,0 +1,2 @@
|
||||
s = u"\N{LATIN SMALL LETTER B}%s\N{NUMBER SIGN}\
|
||||
%s\N{LATIN SMALL LETTER B}" % ("a", "b")
|
||||
@@ -43,4 +43,7 @@ public class PyAddSpecifierToFormatQuickFixTest extends PyQuickFixTestCase {
|
||||
doQuickFixTest(PyStringFormatInspection.class, PyBundle.message("QFIX.NAME.add.specifier"));
|
||||
}
|
||||
|
||||
public void testUnicodeEscapes() {
|
||||
doQuickFixTest(PyStringFormatInspection.class, PyBundle.message("QFIX.NAME.add.specifier"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user