Bug 48641 [typing] Smart paste "fixes" comments
A new feature was added to M5 where smart paste fixes C style comments into Java style comments: /* * */ becomes: /* * */ The problem is that we have lots of text that is formatted the using C style and using smart paste makes the code inconistent. I don't use the feature but others on the team do. Shouldn't smart paste just indent the code?
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaAutoIndentStrategy.java
JavaIndenter indenter= new JavaIndenter(document, scanner);
			int offset= command.offset;
			
			
			int refPos= indenter.findReferencePosition(offset);
			if (refPos == JavaHeuristicScanner.NOT_FOUND)
				return;
			int peerPos= getPeerPosition(document, command);
			peerPos= indenter.findReferencePosition(peerPos);
			refPos= Math.min(refPos, peerPos);
			
			IRegion region= document.getLineInformationOfOffset(refPos);
			int lineOffset= region.getOffset();
			
			
			int endOfWS= scanner.findNonWhitespaceForwardInAnyPartition(lineOffset, JavaHeuristicScanner.UNBOUND);
			if (endOfWS == JavaHeuristicScanner.NOT_FOUND)
				endOfWS= lineOffset;
			String baseIndent= document.get(lineOffset, endOfWS - lineOffset);
			if (refPos == JavaHeuristicScanner.NOT_FOUND)
				return;
			 
			region= document.getLineInformationOfOffset(offset);
			String notSelected= document.get(region.getOffset(), offset - region.getOffset());
			if (notSelected.trim().length() == 0) {
				command.length += notSelected.length();
				command.offset= region.getOffset();
			}