Incorrect behaviour on Text-blocks preceded by return
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện vấn đề với ví dụ TextBlocks.java bằng google-java-format-1.27.0-all-deps.jar, so sánh các khối văn bản được gán cho biến với khối đứng sau return. Theo dõi cách formatter xử lý một câu lệnh return theo sau là một khối văn bản; được xem là hoàn tất khi các dấu ngoặc kép mở sau return được đặt trên một dòng mới mà không thay đổi phần định dạng còn lại được minh họa.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
https://google.github.io/styleguide/javaguide.html#s4.8.9-text-blocks
The opening """ of a text block is always on a new line. That line may either follow the same indentation rules as other constructs, or it may have no indentation at all (so it starts at the left margin). The closing """ is on a new line with the same indentation as the opening """, and may be followed on the same line by further code
Original code:
$ cat TextBlocks.java
/** some javadoc. */
public class TextBlocks {
/** some javadoc. */
public static String textFun(String[] args) {
final String simpleScript = """
s
""";
final String simpleScript1 =
"""
this is simple test;
""";
final String simpleScript2 =
"""
this is sample text """;
return """
this is sample text
""";
}
}
Output by the formatter:
$ java -jar testing/google-java-format-1.27.0-all-deps.jar TextBlocks.java
/** some javadoc. */
public class TextBlocks {
/** some javadoc. */
public static String textFun(String[] args) {
final String simpleScript =
""" // CORRECT BEHAVIOUR
s
""";
final String simpleScript1 =
"""
this is simple test;
""";
final String simpleScript2 =
"""
this is sample text\
"""; // CORRECT BEHAVIOUR
return """ // INCORRECT BEHAVIOUR
this is sample text
""";
}
}
I expected the opening quotations of the text-block after return to be on new line.
- Ngôn ngữ chính
- Java
- Star
- 6.2k
- Fork
- 936
- Merge trung bình
- 6 phút
- Pull request đã merge (30 ngày)
- 3
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của google/google-java-format
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
google/google-java-format#1094 · 1 bình luận ·
-
Complementary Teamups Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
google/google-java-format#1450 · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
google/google-java-format#1439 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
google/google-java-format#1436 · 2 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
google/google-java-format#1428 · 3 bình luận ·
Tất cả issue của google/google-java-format
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
elastic/gradle-plugins#157 ·
-
enhancement Tools
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
apache/rocketmq-dashboard#5008 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
DETECT_PARAMETER_NAMES=false silently disables @ConstructorProperties-based Creator detection too Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
FasterXML/jackson-databind#6229 ·