Bug 43364 [typing] new line insertion sometimes goes wrong!
try and put a new line between the two variable declarations. It will shift the second variable declaration to line up with "c". ------------------------------------------------------------ public class A { private static final String[] var = new String[] { "a", "b", "c", "d"}; private static final int var2 = 4; //press enter at beginning of this line } ------------------------------------------------------------
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaHeuristicScanner.java
return NOT_FOUND;
					
				if (fDocument.getChar(start) == closingPeer)
					depth++;
				else
					depth--;
				
				if (depth == 0)
					return start;
			}
		} catch (BadLocationException e) {
			return NOT_FOUND;
		}
	}
	/**
	 * Computes the surrounding block around <code>offset</code>. The search is started at the
	 * beginning of <code>offset</code>, i.e. an opening brace at <code>offset</code> will not be
	 * part of the surrounding block, but a closing brace will.
	 * 
	 * @param offset the offset for which the surrounding block is computed
	 * @return a region describing the surrounding block, or <code>null</code> if none can be found
	 */
	public IRegion findSurroundingBlock(int offset) {
		if (offset < 1 || offset >= fDocument.getLength())
			return null;
			
		int begin= findOpeningPeer(offset - 1, LBRACE, RBRACE);
		int end= findClosingPeer(offset, LBRACE, RBRACE);
		if (begin == NOT_FOUND || end == NOT_FOUND)
			return null;