Disposable (@NotNull PsiFile injectedFile, @NotNull Document copyDocument) { Place shreds = InjectedLanguageUtilBase.getShreds(injectedFile); Project project = injectedFile.getProject(); PsiLanguageInjectionHost host = Objects.requireNonNull(InjectedLanguageManager.getInstance(project).getInjectionHost(injectedFile)); Editor editor = new ImaginaryEditor(project, host.getContainingFile().getViewProvider().getDocument()); InjectedFileChangesHandler handler = QuickEditHandler.getHandler(injectedFile, editor, shreds, copyDocument); copyDocument.addDocumentListener(new DocumentListener() { @Override public void documentChanged(@NotNull DocumentEvent event) { handler.commitToOriginal(event); } }); return handler; }