com.intellij.codeInsight.completion.CompletionPhase Java Examples
The following examples show how to use
com.intellij.codeInsight.completion.CompletionPhase.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutoPopupControllerImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public void scheduleAutoPopup(@Nonnull Editor editor, @Nonnull CompletionType completionType, @Nullable final Condition<? super PsiFile> condition) { //if (ApplicationManager.getApplication().isUnitTestMode() && !TestModeFlags.is(CompletionAutoPopupHandler.ourTestingAutopopup)) { // return; //} boolean alwaysAutoPopup = Boolean.TRUE.equals(editor.getUserData(ALWAYS_AUTO_POPUP)); if (!CodeInsightSettings.getInstance().AUTO_POPUP_COMPLETION_LOOKUP && !alwaysAutoPopup) { return; } if (PowerSaveMode.isEnabled()) { return; } if (!CompletionServiceImpl.isPhase(CompletionPhase.CommittingDocuments.class, CompletionPhase.NoCompletion.getClass())) { return; } final CompletionProgressIndicator currentCompletion = CompletionServiceImpl.getCurrentCompletionProgressIndicator(); if (currentCompletion != null) { currentCompletion.closeAndFinish(true); } CompletionPhase.CommittingDocuments.scheduleAsyncCompletion(editor, completionType, condition, myProject, null); }
Example #2
Source File: PhpAutoPopupSpaceTypedHandler.java From idea-php-advanced-autocomplete with MIT License | 5 votes |
/** * PhpTypedHandler.scheduleAutoPopup but use SMART since BASIC is blocked */ public void scheduleAutoPopup(final Project project, final Editor editor, @Nullable final Condition<PsiFile> condition) { if (ApplicationManager.getApplication().isUnitTestMode()/* && !CompletionAutoPopupHandler.ourTestingAutopopup*/) { return; } if (!CodeInsightSettings.getInstance().AUTO_POPUP_COMPLETION_LOOKUP) { return; } if (PowerSaveMode.isEnabled()) { return; } if (!CompletionServiceImpl.isPhase(CompletionPhase.CommittingDocuments.class, CompletionPhase.NoCompletion.getClass())) { return; } // // final CompletionProgressIndicator currentCompletion = CompletionServiceImpl.getCompletionService().getCurrentCompletion(); // if (currentCompletion != null) { // currentCompletion.closeAndFinish(true); // } // // final CompletionPhase.CommittingDocuments phase = new CompletionPhase.CommittingDocuments(null, editor); // CompletionServiceImpl.setCompletionPhase(phase); // // CompletionAutoPopupHandler.runLaterWithCommitted(project, editor.getDocument(), new Runnable() { // @Override // public void run() { // CompletionAutoPopupHandler.invokeCompletion(CompletionType.BASIC, true, project, editor, 0, false); // } // }); }
Example #3
Source File: LookupTypedHandler.java From consulo with Apache License 2.0 | 5 votes |
@Override public void execute(@Nonnull Editor originalEditor, char charTyped, @Nonnull DataContext dataContext) { final Project project = dataContext.getData(CommonDataKeys.PROJECT); PsiFile file = project == null ? null : PsiUtilBase.getPsiFileInEditor(originalEditor, project); if (file == null) { if (myOriginalHandler != null) { myOriginalHandler.execute(originalEditor, charTyped, dataContext); } return; } if (!EditorModificationUtil.checkModificationAllowed(originalEditor)) { return; } CompletionPhase oldPhase = CompletionServiceImpl.getCompletionPhase(); if (oldPhase instanceof CompletionPhase.CommittingDocuments && oldPhase.indicator != null) { oldPhase.indicator.scheduleRestart(); } Editor editor = TypedHandler.injectedEditorIfCharTypedIsSignificant(charTyped, originalEditor, file); if (editor != originalEditor) { file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); } if (originalEditor.isInsertMode() && beforeCharTyped(charTyped, project, originalEditor, editor, file)) { return; } if (myOriginalHandler != null) { myOriginalHandler.execute(originalEditor, charTyped, dataContext); } }