Skip to content

Commit

Permalink
Fix #520 Тексты комментариев при форматировании должны обрезаться справа
Browse files Browse the repository at this point in the history
  • Loading branch information
nixel2007 committed Oct 30, 2019
1 parent f8521c9 commit 2902497
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[src/test/resources/providers/format_formatted.bsl]
trim_trailing_whitespace = false
[src/test/resources/providers/format.bsl]
trim_trailing_whitespace = false
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,11 @@ private static List<TextEdit> getTextEdits(
// no-op
}

newTextBuilder.append(token.getText());
String addedText = token.getText();
if (tokenType == BSLLexer.LINE_COMMENT || tokenType == BSLLexer.PREPROC_LINE_COMMENT) {
addedText = addedText.trim();
}
newTextBuilder.append(addedText);

// Increment on operator starts and left paren
if (needIncrementIndent(tokenType)) {
Expand Down
5 changes: 5 additions & 0 deletions src/test/resources/providers/format.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@
Процедура Другая()
А = 0;
КонецПроцедуры

Процедура Третья()
// Комментарий с пробелами слева
// Другой комментарий с пробелами
КонецПроцедуры
5 changes: 5 additions & 0 deletions src/test/resources/providers/format_formatted.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@
Процедура Другая()
А = 0;
КонецПроцедуры

Процедура Третья()
// Комментарий с пробелами слева
// Другой комментарий с пробелами
КонецПроцедуры

1 comment on commit 2902497

@nixel2007
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix #540

Please sign in to comment.