Action on save not run on saveDocument

Answered

Hi! I am writing document content (having path and content defined) (in EDT) as:

vfsFile.findDocument()?.let {
            CommandProcessor.getInstance().executeCommand(
                project,
                {
                    WriteCommandAction.runWriteCommandAction(project) {
                        it.setText(Strings.convertLineSeparators(content))
                        PsiDocumentManager.getInstance(project).commitDocument(it)
                        FileDocumentManager.getInstance().saveDocument(it)
                    }
                },
                "My Write File",
                DocCommandGroupId.noneGroupId(it),
                UndoConfirmationPolicy.DO_NOT_REQUEST_CONFIRMATION
            )
        }

I am using executeCommand to have undo entry available.

It does not trigger ActionOnSave. How can I trigger ActionsOnSave from above? I need to call my own action - I can do it directly but wanted to run all enabled actions also.

Thanks

0
1 comment

`com.intellij.ide.SaveAndSyncHandler#scheduleSave(com.intellij.ide.SaveAndSyncHandler.SaveTask)`

0

Please sign in to leave a comment.