void (@NotNull Project project, @NotNull Editor editor, @NotNull Language language) { LanguageCodeStyleSettingsProvider provider = LanguageCodeStyleSettingsProvider.forLanguage(language); if (provider != null) { ByteArrayOutputStream output = new ByteArrayOutputStream(); try ( EditorConfigSettingsWriter writer = new EditorConfigSettingsWriter(project, output, CodeStyle.getSettings(project), false, false) .forLanguages(language) .forPropertyKinds(EditorConfigPropertyKind.LANGUAGE) .withoutHeaders()) { writer.writeSettings(); writer.flush(); String text = new String(output.toByteArray(), StandardCharsets.UTF_8); CommandProcessor.getInstance().runUndoTransparentAction( () -> ApplicationManager.getApplication().runWriteAction( () -> { editor.getDocument().insertString(editor.getCaretModel().getOffset(), text); } ) ); } catch (IOException e) { LOG.error(e); } } }