mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-18 08:50:57 +07:00
IDEA-67250 Invoke completion automatically when none of the predefined live template variants match
This commit is contained in:
@@ -19,6 +19,8 @@ import com.intellij.codeInsight.completion.impl.CompletionServiceImpl
|
||||
import com.intellij.codeInsight.lookup.Lookup
|
||||
import com.intellij.codeInsight.lookup.LookupManager
|
||||
import com.intellij.codeInsight.lookup.impl.LookupImpl
|
||||
import com.intellij.codeInsight.template.TemplateManager
|
||||
import com.intellij.codeInsight.template.impl.TemplateManagerImpl
|
||||
import com.intellij.ide.DataManager
|
||||
import com.intellij.ide.ui.UISettings
|
||||
import com.intellij.openapi.actionSystem.IdeActions
|
||||
@@ -690,4 +692,29 @@ class Foo {
|
||||
assert myFixture.editor.document.text.contains('foo(aaa,)')
|
||||
}
|
||||
|
||||
public void testCompletionWhenLiveTemplateAreNotSufficient() {
|
||||
((TemplateManagerImpl)TemplateManager.getInstance(getProject())).setTemplateTesting(true);
|
||||
try {
|
||||
myFixture.configureByText("a.java", """
|
||||
class Foo {
|
||||
{
|
||||
Iterable<String> l1 = null;
|
||||
Iterable<String> l2 = null;
|
||||
Object asdf = null;
|
||||
iter<caret>
|
||||
}
|
||||
}
|
||||
""")
|
||||
type '\t'
|
||||
assert myFixture.lookupElementStrings == ['l2', 'l1']
|
||||
type 'as'
|
||||
assert lookup
|
||||
assert myFixture.lookupElementStrings == ['asdf', 'assert']
|
||||
}
|
||||
finally {
|
||||
((TemplateManagerImpl)TemplateManager.getInstance(getProject())).setTemplateTesting(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user