tab should replace the old javadoc param description (IDEA-110166)

This commit is contained in:
peter
2013-07-28 17:56:53 +02:00
parent 8d3167e9c7
commit 7c773d8209
2 changed files with 18 additions and 2 deletions
@@ -168,7 +168,20 @@ public class JavaDocCompletionContributor extends CompletionContributor {
}
});
for (String description : descriptions) {
result.addElement(LookupElementBuilder.create(description));
result.addElement(LookupElementBuilder.create(description).withInsertHandler(new InsertHandler<LookupElement>() {
@Override
public void handleInsert(InsertionContext context, LookupElement item) {
context.commitDocument();
PsiDocTag docTag = PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), context.getStartOffset(), PsiDocTag.class, false);
if (docTag != null) {
int tagEnd = docTag.getTextRange().getEndOffset();
int tail = context.getTailOffset();
if (tail < tagEnd) {
context.getDocument().deleteString(tail, tagEnd);
}
}
}
}));
}
}
@@ -220,7 +220,7 @@ class Foo {
myFixture.configureByText "a.java", '''
class Foo {
/**
* @param intParam so<caret>
* @param intParam so<caret> xxx
*/
void foo2(int intParam, Object param2) { }
@@ -232,6 +232,9 @@ class Foo {
'''
myFixture.completeBasic()
myFixture.assertPreferredCompletionItems 0, 'some', 'some integer param'
myFixture.lookup.currentItem = myFixture.lookupElements[1]
myFixture.type('\t')
assert !myFixture.editor.document.text.contains('xxx')
}
public void "test see super class"() {