mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
tab should replace the old javadoc param description (IDEA-110166)
This commit is contained in:
+14
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -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"() {
|
||||
|
||||
Reference in New Issue
Block a user