Do not commit document on non-kotlin files when trying to perform j2k conversion

#KT-33725 fixed
This commit is contained in:
Ilya Kirillov
2019-09-11 12:23:40 +03:00
parent 13b16cfe75
commit 1cf348baba
@@ -107,10 +107,10 @@ class ConvertTextJavaCopyPasteProcessor : CopyPastePostProcessor<TextBlockTransf
val text = (values.single() as MyTransferableData).text
val psiDocumentManager = PsiDocumentManager.getInstance(project)
psiDocumentManager.commitDocument(editor.document)
val targetFile = psiDocumentManager.getPsiFile(editor.document) as? KtFile ?: return
val useNewJ2k = checkUseNewJ2k(targetFile)
psiDocumentManager.commitDocument(editor.document)
val useNewJ2k = checkUseNewJ2k(targetFile)
val targetModule = targetFile.module
val pasteTarget = detectPasteTarget(targetFile, bounds.startOffset, bounds.endOffset) ?: return
val conversionContext = detectConversionContext(pasteTarget.pasteContext, text, project) ?: return