use of com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl in project intellij-community by JetBrains.
the class ShowIntentionActionsHandler method invoke.
@Override
public void invoke(@NotNull final Project project, @NotNull Editor editor, @NotNull PsiFile file) {
PsiDocumentManager.getInstance(project).commitAllDocuments();
if (editor instanceof EditorWindow) {
editor = ((EditorWindow) editor).getDelegate();
file = InjectedLanguageManager.getInstance(file.getProject()).getTopLevelFile(file);
}
final LookupEx lookup = LookupManager.getActiveLookup(editor);
if (lookup != null) {
lookup.showElementActions();
return;
}
final DaemonCodeAnalyzerImpl codeAnalyzer = (DaemonCodeAnalyzerImpl) DaemonCodeAnalyzer.getInstance(project);
letAutoImportComplete(editor, file, codeAnalyzer);
ShowIntentionsPass.IntentionsInfo intentions = new ShowIntentionsPass.IntentionsInfo();
ShowIntentionsPass.getActionsToShow(editor, file, intentions, -1);
IntentionHintComponent hintComponent = codeAnalyzer.getLastIntentionHint();
if (hintComponent != null) {
IntentionHintComponent.PopupUpdateResult result = hintComponent.isForEditor(editor) ? hintComponent.updateActions(intentions) : IntentionHintComponent.PopupUpdateResult.HIDE_AND_RECREATE;
if (result == IntentionHintComponent.PopupUpdateResult.HIDE_AND_RECREATE) {
hintComponent.hide();
}
}
if (HintManagerImpl.getInstanceImpl().performCurrentQuestionAction())
return;
//intentions check isWritable before modification: if (!file.isWritable()) return;
TemplateState state = TemplateManagerImpl.getTemplateState(editor);
if (state != null && !state.isFinished()) {
return;
}
if (!intentions.isEmpty()) {
IntentionHintComponent.showIntentionHint(project, file, editor, intentions, true);
}
}
use of com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl in project intellij-plugins by JetBrains.
the class FlexHighlightingTest method testDumbMode.
@JSTestOptions({ JSTestOption.WithFlexFacet, JSTestOption.WithGumboSdk })
@SuppressWarnings({ "ConstantConditions" })
public void testDumbMode() throws Exception {
DumbServiceImpl.getInstance(getProject()).setDumb(true);
((DaemonCodeAnalyzerImpl) DaemonCodeAnalyzer.getInstance(getProject())).mustWaitForSmartMode(false, getTestRootDisposable());
XmlNSDescriptor nsDescriptor;
try {
assertTrue(DumbService.isDumb(getProject()));
configureByFile(getBasePath() + "/dumbMode.mxml");
nsDescriptor = ((XmlFile) getFile()).getDocument().getRootTagNSDescriptor();
assertTrue(nsDescriptor.toString(), nsDescriptor instanceof FlexMxmlNSDescriptor);
doDoTest(true, true);
} finally {
DumbServiceImpl.getInstance(getProject()).setDumb(false);
}
nsDescriptor = ((XmlFile) getFile()).getDocument().getRootTagNSDescriptor();
assertTrue(nsDescriptor.toString(), nsDescriptor instanceof FlexMxmlNSDescriptor);
doDoTest(true, true);
}
use of com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl in project intellij-community by JetBrains.
the class DaemonAnalyzerTestCase method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
final LocalInspectionTool[] tools = configureLocalInspectionTools();
InspectionsKt.configureInspections(tools, getProject(), getTestRootDisposable());
DaemonCodeAnalyzerImpl daemonCodeAnalyzer = (DaemonCodeAnalyzerImpl) DaemonCodeAnalyzer.getInstance(getProject());
daemonCodeAnalyzer.prepareForTest();
final StartupManagerImpl startupManager = (StartupManagerImpl) StartupManagerEx.getInstanceEx(getProject());
startupManager.runStartupActivities();
startupManager.startCacheUpdate();
startupManager.runPostStartupActivities();
DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(false);
if (isStressTest()) {
// hack to avoid slowdowns in PyExtensionFactory
IntentionManager.getInstance().getAvailableIntentionActions();
// to cache stuff
PathManagerEx.getTestDataPath();
// pre-load tons of classes
ReferenceProvidersRegistry.getInstance();
// zillion of Dom Sem classes
InjectedLanguageManager.getInstance(getProject());
// pile of annotator classes loads
LanguageAnnotators.INSTANCE.allForLanguage(JavaLanguage.INSTANCE);
LanguageAnnotators.INSTANCE.allForLanguage(StdLanguages.XML);
ProblemHighlightFilter.EP_NAME.getExtensions();
Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
Extensions.getExtensions(XmlSchemaProvider.EP_NAME);
Extensions.getExtensions(XmlFileNSInfoProvider.EP_NAME);
Extensions.getExtensions(ExternalAnnotatorsFilter.EXTENSION_POINT_NAME);
Extensions.getExtensions(IndexPatternBuilder.EP_NAME);
}
}
use of com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl in project intellij-community by JetBrains.
the class DaemonAnalyzerTestCase method tearDown.
@Override
protected void tearDown() throws Exception {
try {
// return default value to avoid unnecessary save
DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true);
final Project project = getProject();
if (project != null) {
((StartupManagerImpl) StartupManager.getInstance(project)).checkCleared();
((DaemonCodeAnalyzerImpl) DaemonCodeAnalyzer.getInstance(project)).cleanupAfterTest();
}
} finally {
super.tearDown();
}
//((VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance()).assertPointersDisposed();
}
use of com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl in project intellij-community by JetBrains.
the class ShowErrorDescriptionAction method isEnabledForFile.
private static boolean isEnabledForFile(Project project, Editor editor, PsiFile file) {
DaemonCodeAnalyzer codeAnalyzer = DaemonCodeAnalyzer.getInstance(project);
HighlightInfo info = ((DaemonCodeAnalyzerImpl) codeAnalyzer).findHighlightByOffset(editor.getDocument(), editor.getCaretModel().getOffset(), false);
return info != null && info.getDescription() != null;
}
Aggregations