@@ -114,6 +114,8 @@ public class JSGraphQLLanguageUIProjectService implements Disposable, FileEditor
114
114
public final static String GRAPH_QL_TOOL_WINDOW_NAME = "GraphQL" ;
115
115
public static final String GRAPH_QL_VARIABLES_JSON = "GraphQL.variables.json" ;
116
116
117
+ private static final Key <Boolean > JSGRAPHQL_SHOW_CONSOLE_ON_ERROR = Key .create ("JSGraphQL.showConsoleOnError" );
118
+
117
119
/**
118
120
* Indicates that this virtual file backs a GraphQL variables editor
119
121
*/
@@ -195,6 +197,15 @@ public static JSGraphQLLanguageUIProjectService getService(@NotNull Project proj
195
197
return ServiceManager .getService (project , JSGraphQLLanguageUIProjectService .class );
196
198
}
197
199
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
+
198
209
public static void showConsole (@ NotNull Project project ) {
199
210
showToolWindowContent (project , ConsoleView .class );
200
211
}
@@ -232,7 +243,7 @@ public void onTextAvailable(ProcessEvent event, Key outputType) {
232
243
if (StringUtils .isNotEmpty (event .getText ())) {
233
244
if (outputType == ProcessOutputTypes .STDERR ) {
234
245
// show the console on errors during initialization
235
- showConsole (myProject );
246
+ showErrorConsole (myProject );
236
247
}
237
248
}
238
249
}
0 commit comments