mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
autopopup sometimes showed no suggestions
This commit is contained in:
@@ -460,5 +460,21 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase {
|
||||
assert lookup
|
||||
}
|
||||
|
||||
public void testHideOnInvalidSymbolAfterBackspace() {
|
||||
myFixture.configureByText("a.java", """
|
||||
class A {
|
||||
Object foo() { this<caret> }
|
||||
}
|
||||
""")
|
||||
type '.'
|
||||
assert lookup
|
||||
type 'c'
|
||||
assert lookup
|
||||
type '\b'
|
||||
assert lookup
|
||||
type 'x'
|
||||
assert !lookup
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
|
||||
package com.intellij.codeInsight.lookup.impl;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionProcess;
|
||||
import com.intellij.codeInsight.completion.CompletionProgressIndicator;
|
||||
import com.intellij.codeInsight.completion.CompletionService;
|
||||
import com.intellij.codeInsight.completion.impl.CompletionServiceImpl;
|
||||
import com.intellij.codeInsight.lookup.LookupManager;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -45,14 +44,14 @@ public class BackspaceHandler extends EditorActionHandler {
|
||||
}
|
||||
});
|
||||
|
||||
if (lookup.truncatePrefix()) {
|
||||
final CompletionProgressIndicator process = CompletionServiceImpl.getCompletionService().getCurrentCompletion();
|
||||
if (lookup.truncatePrefix(process == null || !process.isAutopopupCompletion())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (lookup.getLookupStart() < editor.getCaretModel().getOffset()) {
|
||||
final CompletionProcess process = CompletionService.getCompletionService().getCurrentCompletion();
|
||||
if (process instanceof CompletionProgressIndicator) {
|
||||
((CompletionProgressIndicator)process).scheduleRestart();
|
||||
if (process != null) {
|
||||
process.scheduleRestart();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,11 +317,13 @@ public class LookupImpl extends LightweightHint implements Lookup, Disposable {
|
||||
ListScrollingUtil.ensureIndexIsVisible(myList, myList.getSelectedIndex(), 1);
|
||||
}
|
||||
|
||||
public boolean truncatePrefix() {
|
||||
public boolean truncatePrefix(boolean preserveSelection) {
|
||||
final int len = myAdditionalPrefix.length();
|
||||
if (len == 0) return false;
|
||||
|
||||
markSelectionTouched();
|
||||
if (preserveSelection) {
|
||||
markSelectionTouched();
|
||||
}
|
||||
|
||||
myAdditionalPrefix = myAdditionalPrefix.substring(0, len - 1);
|
||||
myInitialPrefix = null;
|
||||
|
||||
Reference in New Issue
Block a user