[java] makes "convert to basic latin" action tolerable to unclosed doc comments (IDEA-211695)

GitOrigin-RevId: afe4cff35979b4f3ec0c72512d0e555b3f21ac78
This commit is contained in:
Roman Shevchenko
2019-04-28 17:40:30 +03:00
committed by intellij-monorepo-bot
parent 2637084bd4
commit 5146c45ba8
8 changed files with 16 additions and 6 deletions
@@ -160,7 +160,7 @@ public class ConvertToBasicLatinAction extends PsiElementBaseIntentionAction {
@Override
protected PsiElement getSubstitution(PsiElementFactory factory, PsiElement element, String newText) {
return factory.createDocCommentFromText(newText);
return factory.createCommentFromText(newText, element.getParent());
}
private static void loadEntities(Project project) {
@@ -205,10 +205,5 @@ public class ConvertToBasicLatinAction extends PsiElementBaseIntentionAction {
PsiElement findApplicable(PsiElement element) {
return element instanceof PsiComment ? element : null;
}
@Override
protected PsiElement getSubstitution(PsiElementFactory factory, PsiElement element, String newText) {
return factory.createCommentFromText(newText, element.getParent());
}
}
}
@@ -0,0 +1,2 @@
/**<caret>
* Copyright © 2000-2010 JetBrains s.r.o.
@@ -0,0 +1,2 @@
/**
* Copyright &copy; 2000-2010 JetBrains s.r.o.
@@ -0,0 +1 @@
/*<caret> © 2010 JetBrains
@@ -0,0 +1 @@
/* &copy; 2010 JetBrains
@@ -0,0 +1,3 @@
class C {
String s = "<caret>Áî
}
@@ -0,0 +1,3 @@
class C {
String s = "\u00c1\u00ee
}
@@ -19,6 +19,9 @@ public class ConvertToBasicLatinTest extends LightCodeInsightFixtureTestCase {
public void testPlainComment() { doTest(); }
public void testDocComment() { doTest(); }
public void testDocTag() { doTest(); }
public void testUnclosedStringLiteral() { doTest(); }
public void testUnclosedPlainComment() { doTest(); }
public void testUnclosedDocComment() { doTest(); }
private void doTest() {
doEncodingTest(getProject(), "UTF-8", null, () -> {