@@ -225,19 +225,21 @@ public static void openFileEditor(File file, Project project) {
225
225
226
226
227
227
public static void openFileEditorAndSaveState (File file , Project project , Question question , BiConsumer <LeetcodeEditor ,String > consumer ,boolean isOpen ) {
228
- ApplicationManager .getApplication ().invokeLater (() -> {
229
- VirtualFile vf = LocalFileSystem .getInstance ().refreshAndFindFileByIoFile (file );
230
- LeetcodeEditor leetcodeEditor = ProjectConfig .getInstance (project ).getDefEditor (URLUtils .getLeetcodeHost ()+question .getFrontendQuestionId ());
231
- leetcodeEditor .setFrontendQuestionId (URLUtils .getLeetcodeHost ()+question .getFrontendQuestionId ());
232
- leetcodeEditor .setTitleSlug (question .getTitleSlug ());
233
- leetcodeEditor .setHost (URLUtils .getLeetcodeHost ());
234
- consumer .accept (leetcodeEditor ,vf .getPath ());
235
- ProjectConfig .getInstance (project ).addLeetcodeEditor (leetcodeEditor );
236
- if (isOpen ) {
228
+ VirtualFile vf = LocalFileSystem .getInstance ().refreshAndFindFileByIoFile (file );
229
+ LeetcodeEditor leetcodeEditor = ProjectConfig .getInstance (project ).getDefEditor (URLUtils .getLeetcodeHost ()+question .getFrontendQuestionId ());
230
+ leetcodeEditor .setFrontendQuestionId (URLUtils .getLeetcodeHost ()+question .getFrontendQuestionId ());
231
+ leetcodeEditor .setTitleSlug (question .getTitleSlug ());
232
+ leetcodeEditor .setHost (URLUtils .getLeetcodeHost ());
233
+ consumer .accept (leetcodeEditor ,vf .getPath ());
234
+ ProjectConfig .getInstance (project ).addLeetcodeEditor (leetcodeEditor );
235
+
236
+ if (isOpen ) {
237
+ ApplicationManager .getApplication ().invokeLater (() -> {
237
238
OpenFileDescriptor descriptor = new OpenFileDescriptor (project , vf );
238
239
FileEditorManager .getInstance (project ).openTextEditor (descriptor , false );
239
- }
240
- });
240
+ });
241
+ }
242
+
241
243
}
242
244
243
245
public static void saveEditDocument (VirtualFile file ){
0 commit comments