mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix empty info popup shown for completion hints
This commit is contained in:
+4
-1
@@ -236,7 +236,10 @@ public class MethodParameterInfoHandler implements ParameterInfoHandlerWithTabAc
|
||||
return;
|
||||
}
|
||||
|
||||
int index = ParameterInfoUtils.getCurrentParameterIndex(o.getNode(), context.getOffset(), JavaTokenType.COMMA);
|
||||
int offset = context.getOffset();
|
||||
TextRange elRange = o.getTextRange();
|
||||
int index = offset <= elRange.getStartOffset() || offset >= elRange.getEndOffset()
|
||||
? -1 : ParameterInfoUtils.getCurrentParameterIndex(o.getNode(), offset, JavaTokenType.COMMA);
|
||||
context.setCurrentParameter(index);
|
||||
|
||||
Object[] candidates = context.getObjectsToView();
|
||||
|
||||
+12
@@ -610,6 +610,18 @@ public class CompletionHintsTest extends LightFixtureCompletionTestCase {
|
||||
checkHintContents(null);
|
||||
}
|
||||
|
||||
public void testPopupAfterCaretMovesOutsideOfParenthesis() throws Exception {
|
||||
configureJava("class C { void m() { System.getPro<caret> } }");
|
||||
complete("getProperty(String key, String def)");
|
||||
waitForAllAsyncStuff();
|
||||
checkHintContents("<html>@NotNull String</html>");
|
||||
left();
|
||||
left();
|
||||
left();
|
||||
waitForAllAsyncStuff();
|
||||
checkHintContents(null);
|
||||
}
|
||||
|
||||
private void checkResult(String text) {
|
||||
myFixture.checkResult(text);
|
||||
}
|
||||
|
||||
@@ -309,6 +309,14 @@ public class ParameterInfoController implements Disposable {
|
||||
|
||||
if (elementForUpdating != null) {
|
||||
myHandler.updateParameterInfo(elementForUpdating, context);
|
||||
if (mySingleParameterInfo) {
|
||||
if (myComponent.getCurrentParameterIndex() == -1 && myHint.isVisible()) {
|
||||
myHint.hide();
|
||||
}
|
||||
else if (myComponent.getCurrentParameterIndex() != -1 && !myHint.isVisible()) {
|
||||
AutoPopupController.getInstance(myProject).autoPopupParameterInfo(myEditor, null);
|
||||
}
|
||||
}
|
||||
if (!myDisposed && myHint.isVisible() && !myEditor.isDisposed() &&
|
||||
(myEditor.getComponent().getRootPane() != null || ApplicationManager.getApplication().isUnitTestMode())) {
|
||||
myComponent.update(mySingleParameterInfo);
|
||||
|
||||
Reference in New Issue
Block a user