int (final Editor editor, int tailOffset) { PsiFile psiFile = PsiEditorUtil.getPsiFile(editor); Language language = PsiUtilCore.getLanguageAtOffset(PsiEditorUtil.getPsiFile(editor), tailOffset); CodeStyleSettingsFacade codeStyleFacade = CodeStyle.getFacade(psiFile).withLanguage(language); if (codeStyleFacade.isSpaceBeforeComma()) tailOffset = insertChar(editor, tailOffset, ' '); tailOffset = insertChar(editor, tailOffset, ','); if (codeStyleFacade.isSpaceAfterComma()) tailOffset = insertChar(editor, tailOffset, ' '); return tailOffset; }