@@ -114,6 +114,8 @@ public class JSGraphQLLanguageUIProjectService implements Disposable, FileEditor
114114 public final static String GRAPH_QL_TOOL_WINDOW_NAME = "GraphQL" ;
115115 public static final String GRAPH_QL_VARIABLES_JSON = "GraphQL.variables.json" ;
116116
117+ private static final Key <Boolean > JSGRAPHQL_SHOW_CONSOLE_ON_ERROR = Key .create ("JSGraphQL.showConsoleOnError" );
118+
117119 /**
118120 * Indicates that this virtual file backs a GraphQL variables editor
119121 */
@@ -195,6 +197,15 @@ public static JSGraphQLLanguageUIProjectService getService(@NotNull Project proj
195197 return ServiceManager .getService (project , JSGraphQLLanguageUIProjectService .class );
196198 }
197199
200+ public static void showErrorConsole (@ NotNull Project project ) {
201+ final Boolean showConsoleOnError = project .getUserData (JSGRAPHQL_SHOW_CONSOLE_ON_ERROR );
202+ if (!Boolean .FALSE .equals (showConsoleOnError )) {
203+ // only show the console automatically on the first error in the project
204+ showToolWindowContent (project , ConsoleView .class );
205+ project .putUserData (JSGRAPHQL_SHOW_CONSOLE_ON_ERROR , false );
206+ }
207+ }
208+
198209 public static void showConsole (@ NotNull Project project ) {
199210 showToolWindowContent (project , ConsoleView .class );
200211 }
@@ -232,7 +243,7 @@ public void onTextAvailable(ProcessEvent event, Key outputType) {
232243 if (StringUtils .isNotEmpty (event .getText ())) {
233244 if (outputType == ProcessOutputTypes .STDERR ) {
234245 // show the console on errors during initialization
235- showConsole (myProject );
246+ showErrorConsole (myProject );
236247 }
237248 }
238249 }
0 commit comments