Lines 2217-2231
Link Here
|
2217 |
// then it becomes not a good idea to change the trailing flag |
2217 |
// then it becomes not a good idea to change the trailing flag |
2218 |
if (trailing == BASIC_TRAILING_COMMENT && hasLineComment) { |
2218 |
if (trailing == BASIC_TRAILING_COMMENT && hasLineComment) { |
2219 |
int currentCommentIndentation = getCurrentIndentation(whiteSpaces, 0); |
2219 |
int currentCommentIndentation = getCurrentIndentation(whiteSpaces, 0); |
2220 |
int lastCommentIndentation = this.lastLineComment.currentIndentation; |
2220 |
int relativeIndentation = currentCommentIndentation - this.lastLineComment.currentIndentation; |
2221 |
if (this.tabLength > 0) { |
2221 |
if (this.tabLength == 0) { |
2222 |
if ((currentCommentIndentation % this.tabLength) == 0) { |
2222 |
canChangeTrailing = relativeIndentation == 0; |
2223 |
lastCommentIndentation = (lastCommentIndentation / this.tabLength) * this.tabLength; |
2223 |
} else { |
2224 |
} else { |
2224 |
canChangeTrailing = relativeIndentation > -this.tabLength; |
2225 |
currentCommentIndentation = ((currentCommentIndentation / this.tabLength) + 1) * this.tabLength; |
|
|
2226 |
} |
2227 |
} |
2225 |
} |
2228 |
canChangeTrailing = currentCommentIndentation >= lastCommentIndentation; |
|
|
2229 |
} |
2226 |
} |
2230 |
// if the trailing can be change, then look at the following tokens |
2227 |
// if the trailing can be change, then look at the following tokens |
2231 |
if (canChangeTrailing) { |
2228 |
if (canChangeTrailing) { |
Lines 2494-2508
Link Here
|
2494 |
int currentCommentIndentation = getCurrentIndentation(this.lastLineComment.leadingSpaces, 0); |
2491 |
int currentCommentIndentation = getCurrentIndentation(this.lastLineComment.leadingSpaces, 0); |
2495 |
// Keep the current comment indentation when over the previous contiguous line comment |
2492 |
// Keep the current comment indentation when over the previous contiguous line comment |
2496 |
// and the previous comment has not been reindented |
2493 |
// and the previous comment has not been reindented |
2497 |
int lastCommentIndentation = this.lastLineComment.currentIndentation; |
2494 |
int relativeIndentation = currentCommentIndentation - this.lastLineComment.currentIndentation; |
2498 |
if (this.tabLength > 0) { |
2495 |
boolean similarCommentsIndentation = false; |
2499 |
if ((currentCommentIndentation % this.tabLength) == 0) { |
2496 |
if (this.tabLength == 0) { |
2500 |
lastCommentIndentation = (lastCommentIndentation / this.tabLength) * this.tabLength; |
2497 |
similarCommentsIndentation = relativeIndentation == 0; |
2501 |
} else { |
2498 |
} else if (relativeIndentation > -this.tabLength) { |
2502 |
currentCommentIndentation = ((currentCommentIndentation / this.tabLength) + 1) * this.tabLength; |
2499 |
similarCommentsIndentation = this.formatter.preferences.comment_format_line_comment_starting_on_first_column || |
2503 |
} |
2500 |
(currentCommentIndentation != 0 && this.lastLineComment.currentIndentation != 0); |
2504 |
} |
2501 |
} |
2505 |
if (currentCommentIndentation >= lastCommentIndentation && this.lastLineComment.indentation != this.indentationLevel) { |
2502 |
if (similarCommentsIndentation && this.lastLineComment.indentation != this.indentationLevel) { |
2506 |
int currentIndentationLevel = this.indentationLevel; |
2503 |
int currentIndentationLevel = this.indentationLevel; |
2507 |
this.indentationLevel = this.lastLineComment.indentation ; |
2504 |
this.indentationLevel = this.lastLineComment.indentation ; |
2508 |
printIndentationIfNecessary(); |
2505 |
printIndentationIfNecessary(); |