mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
preserve javadoc refs during inplace rename (IDEA-85817)
This commit is contained in:
@@ -220,6 +220,7 @@ public class JavaDocCompletionContributor extends CompletionContributor {
|
||||
if (context.getCompletionChar() == Lookup.REPLACE_SELECT_CHAR) {
|
||||
final PsiDocTagValue valueElement = tag.getValueElement();
|
||||
endOffset = valueElement.getTextRange().getEndOffset();
|
||||
context.setTailOffset(endOffset);
|
||||
}
|
||||
editor.getDocument().deleteString(afterSharp, endOffset);
|
||||
editor.getCaretModel().moveToOffset(signatureOffset);
|
||||
|
||||
@@ -381,18 +381,6 @@ public class PsiDocMethodOrFieldRef extends CompositePsiElement implements PsiDo
|
||||
if (nextSibling != null) {
|
||||
final int startOffset = nextSibling.getTextRange().getStartOffset() - getTextRange().getStartOffset();
|
||||
int endOffset = nextSibling.getTextRange().getEndOffset() - getTextRange().getStartOffset();
|
||||
final PsiElement nextParSibling = nextSibling.getNextSibling();
|
||||
if (nextParSibling != null && "(".equals(nextParSibling.getText())) {
|
||||
endOffset++;
|
||||
PsiElement nextElement = nextParSibling.getNextSibling();
|
||||
if (nextElement != null && SourceTreeToPsiMap.psiToTreeNotNull(nextElement).getElementType() == DOC_TAG_VALUE_TOKEN) {
|
||||
endOffset += nextElement.getTextLength();
|
||||
nextElement = nextElement.getNextSibling();
|
||||
}
|
||||
if (nextElement != null && ")".equals(nextElement.getText())) {
|
||||
endOffset++;
|
||||
}
|
||||
}
|
||||
return new TextRange(startOffset, endOffset);
|
||||
}
|
||||
return new TextRange(getTextLength(), getTextLength());
|
||||
|
||||
@@ -2,7 +2,7 @@ class Test {
|
||||
|
||||
public void i(int ppp) {}
|
||||
/**
|
||||
* {@link #<error>foo(int)</error>}
|
||||
* {@link #<error descr="Cannot resolve symbol 'foo(int)'">foo</error>(int)}
|
||||
* {@link #foo()}
|
||||
* {@link #i(int)}
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Test {
|
||||
/**
|
||||
* @see #<error>perform(int)</error>
|
||||
* @see #<error descr="Cannot resolve symbol 'perform(int)'">perform</error>(int)
|
||||
*/
|
||||
public void i() {}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
public class Test {
|
||||
/**
|
||||
* @see Test#test(String, int...)
|
||||
* @see Test#<error>test(String, long...)</error>
|
||||
* @see Test#<error descr="Cannot resolve symbol 'test(String, long...)'">test</error>(String, long...)
|
||||
**/
|
||||
void foo() {}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package pkg;
|
||||
|
||||
/**
|
||||
* @see #<error descr="Cannot resolve symbol 'method(B1.C)'">method(B1.C)</error>
|
||||
* @see #<error descr="Cannot resolve symbol 'method(B1.C[][])'">method(B1.C[][])</error>
|
||||
* @see #<error descr="Cannot resolve symbol 'method(B1.C..)'">method(<error descr="Cannot resolve symbol 'B1.C.'">B1.C.</error>.)</error>
|
||||
* @see #<error descr="Cannot resolve symbol 'method(B1.C[)'">method(B1.C[)</error>
|
||||
* @see #<error descr="Cannot resolve symbol 'method(B1.C)'">method</error>(B1.C)
|
||||
* @see #<error descr="Cannot resolve symbol 'method(B1.C[][])'">method</error>(B1.C[][])
|
||||
* @see #<error descr="Cannot resolve symbol 'method(B1.C..)'">method</error>(<error descr="Cannot resolve symbol 'B1.C.'">B1.C.</error>.)
|
||||
* @see #<error descr="Cannot resolve symbol 'method(B1.C[)'">method</error>(B1.C[)
|
||||
*/
|
||||
class A1 {
|
||||
public void method(B1.C[] c) { }
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
public class RefactorBug {
|
||||
public static void som<caret>ething(int a, float b) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #something(int, float)
|
||||
*/
|
||||
public static void somethingElse() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
public class RefactorBug {
|
||||
public static void bar(int a, float b) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #bar(int, float)
|
||||
*/
|
||||
public static void somethingElse() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,10 @@ public class RenameMembersInplaceTest extends LightCodeInsightTestCase {
|
||||
public void testClassWithMultipleConstructors() throws Exception {
|
||||
doTestInplaceRename("Bar");
|
||||
}
|
||||
|
||||
public void testMethodWithJavadocRef() throws Exception {
|
||||
doTestInplaceRename("bar");
|
||||
}
|
||||
|
||||
public void testConflictingMethodName() throws Exception {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user