void (@NotNull PsiElement comma, PsiElement prev, PsiElement next) { DocumentEx document = (DocumentEx)comma.getContainingFile().getViewProvider().getDocument(); if (document == null) return; String prevText = prev.getText(); String nextText = next.getText(); TextRange prevRange = prev.getTextRange(); TextRange nextRange = next.getTextRange(); document.replaceString(prevRange.getStartOffset(), prevRange.getEndOffset(), nextText); nextRange = nextRange.shiftRight(nextText.length() - prevText.length()); document.replaceString(nextRange.getStartOffset(), nextRange.getEndOffset(), prevText); }