File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
utbot-intellij-js/src/main/kotlin/org/utbot/intellij/plugin/language/js Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -186,13 +186,16 @@ object JsDialogProcessor {
186
186
val generatedCode = testGenerator.run ()
187
187
invokeLater {
188
188
runWriteAction {
189
- val testPsiFile = testDir.findFile(testFileName) ? : PsiFileFactory .getInstance(project)
190
- .createFileFromText(testFileName, JsLanguageAssistant .jsLanguage, generatedCode)
189
+ val testPsiFile = testDir.findFile(testFileName) ? : run {
190
+ val temp = PsiFileFactory .getInstance(project)
191
+ .createFileFromText(testFileName, JsLanguageAssistant .jsLanguage, generatedCode)
192
+ testDir.add(temp)
193
+ testDir.findFile(testFileName)!!
194
+ }
191
195
val testFileEditor = CodeInsightUtil .positionCursor(project, testPsiFile, testPsiFile)
192
196
unblockDocument(project, testFileEditor.document)
193
197
testFileEditor.document.setText(generatedCode)
194
198
unblockDocument(project, testFileEditor.document)
195
- testDir.findFile(testFileName) ? : testDir.add(testPsiFile)
196
199
}
197
200
}
198
201
}
You can’t perform that action at this time.
0 commit comments