use of com.intellij.codeInsight.lookup.LookupEx in project intellij-plugins by JetBrains.
the class ActionScriptHighlightingTest method runRenameSpellcheckerFixWithChooseVariant.
private void runRenameSpellcheckerFixWithChooseVariant(String variantName) throws Exception {
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
enableInspectionTool(new SpellCheckingInspection());
doSimpleHighlightingWithInvokeFixAndCheckResult("Typo: Rename to...");
final LookupEx lookup = LookupManager.getActiveLookup(myEditor);
assertNotNull(lookup);
boolean selected = false;
for (LookupElement l : lookup.getItems()) {
if (variantName.equals(l.getLookupString())) {
selected = true;
((LookupImpl) lookup).finishLookup(Lookup.AUTO_INSERT_SELECT_CHAR, l);
}
}
assertTrue(selected);
LookupManager.getInstance(myProject).hideActiveLookup();
checkResultByFile(BASE_PATH + getTestName(false) + "_after2.js2");
}
use of com.intellij.codeInsight.lookup.LookupEx in project android by JetBrains.
the class AndroidLayoutDomTest method testDimenUnitsCompletion1.
public void testDimenUnitsCompletion1() throws Exception {
VirtualFile file = copyFileToProject(getTestName(true) + ".xml");
myFixture.configureFromExistingVirtualFile(file);
myFixture.complete(CompletionType.BASIC);
UsefulTestCase.assertSameElements(myFixture.getLookupElementStrings(), "3dp", "3px", "3sp", "3pt", "3mm", "3in");
PsiElement originalElement = myFixture.getFile().findElementAt(myFixture.getEditor().getCaretModel().getOffset());
LookupEx lookup = myFixture.getLookup();
LookupElement dpElement = null;
LookupElement pxElement = null;
for (LookupElement element : lookup.getItems()) {
if (element.getLookupString().endsWith("dp")) {
dpElement = element;
} else if (element.getLookupString().endsWith("px")) {
pxElement = element;
}
}
DocumentationProvider provider;
PsiElement docTargetElement;
lookup.setCurrentItem(dpElement);
docTargetElement = DocumentationManager.getInstance(getProject()).findTargetElement(myFixture.getEditor(), myFixture.getFile(), originalElement);
provider = DocumentationManager.getProviderFromElement(docTargetElement);
assertEquals("<html><body><b>Density-independent Pixels</b> - an abstract unit that is based on the physical " + "density of the screen.</body></html>", provider.generateDoc(docTargetElement, originalElement));
lookup.setCurrentItem(pxElement);
docTargetElement = DocumentationManager.getInstance(getProject()).findTargetElement(myFixture.getEditor(), myFixture.getFile(), originalElement);
provider = DocumentationManager.getProviderFromElement(docTargetElement);
assertEquals("<html><body><b>Pixels</b> - corresponds to actual pixels on the screen. Not recommended.</body></html>", provider.generateDoc(docTargetElement, originalElement));
}
use of com.intellij.codeInsight.lookup.LookupEx in project intellij-plugins by JetBrains.
the class DartServerCompletionTest method selectLookup.
private void selectLookup(@NotNull final String lookupToSelect, final char completionChar) {
final LookupEx activeLookup = LookupManager.getActiveLookup(getEditor());
assertNotNull(activeLookup);
final LookupElement lookup = ContainerUtil.find(activeLookup.getItems(), element -> lookupToSelect.equals(element.getLookupString()));
assertNotNull(lookupToSelect + " is not in the completion list", lookup);
activeLookup.setCurrentItem(lookup);
myFixture.finishLookup(completionChar);
}
Aggregations