Fix console filters not being properly set up on first project open.
Blaze#isBlazeProject returns null during initial project creation, which is when project services are set up.
@@ -43,6 +43,7 @@ import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.markup.RangeHighlighter;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.psi.search.GlobalSearchScope;
@@ -81,11 +82,17 @@ public class BlazeConsoleView implements Disposable {
/* viewer= */ false,
/* usePredefinedFilters= */ false);
+ Disposer.register(this, consoleView);
+
+ // setup filters after project creation is complete and BlazeImportSettings have been set
+ StartupManager.getInstance(project).registerPostStartupActivity(this::initializeFilters);
+ }
+
+ private void initializeFilters() {
consoleView.addMessageFilter(customFilters);
addWrappedPredefinedFilters();
// add target filter last, so it doesn't override other links containing a target string
consoleView.addMessageFilter(new BlazeTargetFilter(false));
- Disposer.register(this, consoleView);
}
public static BlazeConsoleView getInstance(Project project) {
