private void applyFormatOff() { for (Token[] offPair : this.tokenManager.getDisableFormatTokenPairs()) { final int offStart = offPair[0].originalStart; final int offEnd = offPair[1].originalEnd; offPair[0].setWrapPolicy(null); offPair[0] .setIndent(Math.min(offPair[0].getIndent(), this.tokenManager.findSourcePositionInLine(offStart))); final List<IRegion> result = new ArrayList<>(); for (IRegion region : this.formatRegions) { final int start = region.getOffset(), end = region.getOffset() + region.getLength() - 1; if (offEnd < start || end < offStart) { result.add(region); } else if (offStart <= start && end <= offEnd) { // whole region off } else { if (start < offStart) result.add(new Region(start, offStart - start)); if (offEnd < end) result.add(new Region(offEnd + 1, end - offEnd)); } } this.formatRegions = result; } }
int commentStartPosition = commentStartPositionInLine; if (commentStartPosition < 0) commentStartPosition = this.tm.findSourcePositionInLine(commentToken.originalStart); int positionInLine = commentStartPosition; int lineStart = 0;
int commentStartPosition = commentStartPositionInLine; if (commentStartPosition < 0) commentStartPosition = this.tm.findSourcePositionInLine(commentToken.originalStart); int positionInLine = commentStartPosition; int lineStart = 0;
int commentStartPosition = commentStartPositionInLine; if (commentStartPosition < 0) commentStartPosition = this.tm.findSourcePositionInLine(commentToken.originalStart); int positionInLine = commentStartPosition; int lineStart = 0;
private void applyFormatOff() { for (Token[] offPair : this.tokenManager.getDisableFormatTokenPairs()) { final int offStart = offPair[0].originalStart; final int offEnd = offPair[1].originalEnd; offPair[0].setWrapPolicy(null); offPair[0] .setIndent(Math.min(offPair[0].getIndent(), this.tokenManager.findSourcePositionInLine(offStart))); final List<IRegion> result = new ArrayList<>(); for (IRegion region : this.formatRegions) { final int start = region.getOffset(), end = region.getOffset() + region.getLength() - 1; if (offEnd < start || end < offStart) { result.add(region); } else if (offStart <= start && end <= offEnd) { // whole region off } else { if (start < offStart) result.add(new Region(start, offStart - start)); if (offEnd < end) result.add(new Region(offEnd + 1, end - offEnd)); } } this.formatRegions = result; } }
Javadoc javadoc = (Javadoc) cu.getCommentList().get(0); javadoc.accept(commentsPreparator); int startPosition = this.tokenManager.findSourcePositionInLine(token.originalStart); commentWrapper.wrapMultiLineComment(token, startPosition, false, false); if (token.tokenType == TokenNameCOMMENT_BLOCK) { commentsPreparator.handleBlockComment(i); int startPosition = this.tokenManager.findSourcePositionInLine(token.originalStart); commentWrapper.wrapMultiLineComment(token, startPosition, false, false); token = this.tokens.get(i); int startPosition = this.tokenManager.findSourcePositionInLine(token.originalStart); commentWrapper.wrapLineComment(token, startPosition);
Javadoc javadoc = (Javadoc) cu.getCommentList().get(0); javadoc.accept(commentsPreparator); int startPosition = this.tokenManager.findSourcePositionInLine(token.originalStart); commentWrapper.wrapMultiLineComment(token, startPosition, false, false); if (token.tokenType == TokenNameCOMMENT_BLOCK) { commentsPreparator.handleBlockComment(i); int startPosition = this.tokenManager.findSourcePositionInLine(token.originalStart); commentWrapper.wrapMultiLineComment(token, startPosition, false, false); token = this.tokens.get(i); int startPosition = this.tokenManager.findSourcePositionInLine(token.originalStart); commentWrapper.wrapLineComment(token, startPosition);
Javadoc javadoc = (Javadoc) cu.getCommentList().get(0); javadoc.accept(commentsPreparator); int startPosition = this.tokenManager.findSourcePositionInLine(token.originalStart); commentWrapper.wrapMultiLineComment(token, startPosition, false, false); if (token.tokenType == TokenNameCOMMENT_BLOCK) { commentsPreparator.handleBlockComment(i); int startPosition = this.tokenManager.findSourcePositionInLine(token.originalStart); commentWrapper.wrapMultiLineComment(token, startPosition, false, false); token = this.tokens.get(i); int startPosition = this.tokenManager.findSourcePositionInLine(token.originalStart); commentWrapper.wrapLineComment(token, startPosition);
public void applyFormatOff() { if (this.formatOffTagPairs == null) return; for (Token[] pair : this.formatOffTagPairs) { int index1 = findIndex(pair[0].originalStart, -1, false); int index2 = findIndex(pair[1].originalEnd, -1, false); pair[0] = get(index1); pair[1] = get(index2); Token unformatted = new Token(pair[0].originalStart, pair[1].originalEnd, TokenNameWHITESPACE); unformatted.setIndent(Math.min(pair[0].getIndent(), findSourcePositionInLine(pair[0].originalStart))); unformatted.putLineBreaksBefore(pair[0].getLineBreaksBefore()); if (pair[0].isSpaceBefore()) unformatted.spaceBefore(); unformatted.putLineBreaksAfter(pair[1].getLineBreaksAfter()); if (pair[1].isSpaceAfter()) unformatted.spaceAfter(); this.tokens.set(index1, unformatted); this.tokens.subList(index1 + 1, index2 + 1).clear(); } } }
int positionInLine = this.tm.findSourcePositionInLine(commentToken.originalStart); boolean isContinuation = commentIndex > 0 && this.tm.get(commentIndex - 1) == this.lastLineComment && (positionInLine >= this.lastLineCommentPosition - this.options.indentation_size + 1)
int positionInLine = this.tm.findSourcePositionInLine(commentToken.originalStart); boolean isContinuation = commentIndex > 0 && this.tm.get(commentIndex - 1) == this.lastLineComment && (positionInLine >= this.lastLineCommentPosition - this.options.indentation_size + 1)
int positionInLine = this.tm.findSourcePositionInLine(commentToken.originalStart); boolean isContinuation = commentIndex > 0 && this.tm.get(commentIndex - 1) == this.lastLineComment && (positionInLine >= this.lastLineCommentPosition - this.options.indentation_size + 1)