private void appendConstToLastDeclaration(RangeMarker[] exprMarkers, String declaration,
GoConstDeclarations declarations) {
RangeMarker originalRange = document.createRangeMarker(declarations.getTextRange());
GoConstDeclaration[] consts = declarations.getDeclarations();
GoConstDeclaration lastConst = consts[consts.length - 1];
if (consts.length == 1 && !isEnclosedByParenthesis(consts[0])) {
SmartPsiElementPointer<GoConstDeclarations> declPointer = createSmartElementPointer(declarations);
SmartPsiElementPointer<GoConstDeclaration> lastConstPointer = createSmartElementPointer(lastConst);
addParentheses(declarations);
lastConst = lastConstPointer.getElement();
declarations = declPointer.getElement();
if (lastConst == null || declarations == null) {
return;
}
originalRange = document.createRangeMarker(declarations.getTextRange());
}
int offset = lastConst.getTextOffset() + lastConst.getTextLength();
String stmt = "\n$" + VARIABLE + "$ = " + declaration;
startRenaming(editor, exprMarkers, offset, stmt, originalRange);
}