Fix "Attempt to modify PSI for non-committed document" for some cases
It can be thrown after an action when optimize imports is called
This commit is contained in:
@@ -93,6 +93,7 @@ class ConvertReceiverToParameterIntention : SelfTargetingOffsetIndependentIntent
|
||||
runWriteAction {
|
||||
function.setReceiverTypeReference(addedParameter.typeReference)
|
||||
function.valueParameterList!!.removeParameter(addedParameter)
|
||||
PsiDocumentManager.getInstance(project).commitDocument(editor.document)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -35,6 +35,9 @@ class FqNameFixingMoveJavaFileHandler : MoveFileHandler() {
|
||||
val newPackage = JavaDirectoryService.getInstance().getPackage(moveDestination) ?: return
|
||||
if (!FileTypeUtils.isInServerPageFile(file) && !PsiUtil.isModuleFile(file)) {
|
||||
file.packageName = newPackage.qualifiedName
|
||||
with(PsiDocumentManager.getInstance(file.project)) {
|
||||
commitDocument(getDocument(file) ?: return@with)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user