int (final Editor editor, int tailOffset) { CommonCodeStyleSettings styleSettings = CodeStyle.getLocalLanguageSettings(editor, tailOffset); if (isSpaceBeforeParentheses(styleSettings, editor, tailOffset)) { tailOffset = insertChar(editor, tailOffset, ' '); } Document document = editor.getDocument(); if (tailOffset < document.getTextLength() && document.getCharsSequence().charAt(tailOffset) == '(') { return moveCaret(editor, tailOffset, 1); } tailOffset = insertChar(editor, tailOffset, '('); if (isSpaceWithinParentheses(styleSettings, editor, tailOffset)) { tailOffset = insertChar(editor, tailOffset, ' '); tailOffset = insertChar(editor, tailOffset, ' '); tailOffset = insertChar(editor, tailOffset, ')'); moveCaret(editor, tailOffset, -2); } else { tailOffset = insertChar(editor, tailOffset, ')'); moveCaret(editor, tailOffset, -1); TabOutScopesTracker.getInstance().registerEmptyScopeAtCaret(editor); } return tailOffset; }