mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Escape string characters (EA-231511)
in "Incorrect string capitalization" inspection quick fix GitOrigin-RevId: 50be278cfa1d9ce15d1ea9f0287e214fd5a5a961
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d633106f23
commit
14fcbcacac
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInspection.capitalization;
|
||||
|
||||
import com.intellij.codeInspection.*;
|
||||
@@ -166,7 +166,7 @@ public class TitleCapitalizationInspection extends AbstractBaseJavaLocalInspecti
|
||||
if (value == null) return;
|
||||
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project);
|
||||
final PsiExpression newExpression =
|
||||
factory.createExpressionFromText('"' + value.fixCapitalization(myCapitalization) + '"', element);
|
||||
factory.createExpressionFromText('"' + StringUtil.escapeStringCharacters(value.fixCapitalization(myCapitalization)) + '"', element);
|
||||
element.replace(newExpression);
|
||||
}
|
||||
else if (element instanceof PsiMethodCallExpression) {
|
||||
|
||||
@@ -3,6 +3,7 @@ import org.jetbrains.annotations.Nls;
|
||||
class TitleCapitalization {
|
||||
@Nls(capitalization = Nls.Capitalization.Title)
|
||||
public String getName() {
|
||||
return <warning descr="String 'Foo bar' is not properly capitalized. It should have title capitalization">"Foo b<caret>ar"</warning>;
|
||||
return <warning descr="String 'Foo
|
||||
bar' is not properly capitalized. It should have title capitalization">"Foo\nb<caret>ar"</warning>;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,6 +3,6 @@ import org.jetbrains.annotations.Nls;
|
||||
class TitleCapitalization {
|
||||
@Nls(capitalization = Nls.Capitalization.Title)
|
||||
public String getName() {
|
||||
return "Foo Bar";
|
||||
return "Foo\nBar";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user