Editor () { PsiFile consoleFile = myConsole.getFile(); Language language = consoleFile.getLanguage(); Project project = consoleFile.getProject(); PsiFile psiFile = PsiFileFactory.getInstance(project).createFileFromText( "a." + consoleFile.getFileType().getDefaultExtension(), language, StringUtil.convertLineSeparators(StringUtil.trimEnd("", "\n")), false, true); VirtualFile virtualFile = psiFile.getViewProvider().getVirtualFile(); if (virtualFile instanceof LightVirtualFile) ((LightVirtualFile)virtualFile).setWritable(true); Document document = Objects.requireNonNull(FileDocumentManager.getInstance().getDocument(virtualFile)); EditorFactory editorFactory = EditorFactory.getInstance(); EditorEx editor = (EditorEx)editorFactory.createViewer(document, project); editor.getSettings().setFoldingOutlineShown(false); editor.getSettings().setLineMarkerAreaShown(false); editor.getSettings().setIndentGuidesShown(false); SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(language, project, psiFile.getViewProvider().getVirtualFile()); editor.setHighlighter(new LexerEditorHighlighter(highlighter, editor.getColorsScheme())); return editor; }