redhat-developer / redhat-developer/vscode-java

Inconsistency in line break "{}" formatting in Java with in VS Code

Đang mở
#3,694 7 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
TypeScript
Star
2.3k
Fork
547
Merge trung bình
20 giờ 1 phút
Pull request đã merge (30 ngày)
11

Mô tả

In my VSC I have the extension called "Language support for java(TM) by red hat". The typical one that all of us who do Java have and this is self-evident. The formatter of said extension does not format correctly. Surely the formatting is taken from LLVM so there is some error or even some incorrect syntax when formatting

When I format in VSC this example code with java or java spring boot:

❌Incorrect - If I format like this, it leaves it like this
This happens on both the opening "{" and the ending "}". It seems that the extra space has no influence since the format accepts both together and extra spacing. When the correct one is the second one with the extra spacing.

Incorrect Preview
image image image
Also say the formatting of the extension also leaves it like this if the code is like this.image

3 incorrect formats accepted by the formatter have been shown. Therefore, if there is any code "in that format", the formatter will leave it that way. Only the correct one is the last one or the one made by Eclipse.
This doesn't make much sense since the code is stuck above or below or even between the curly braces "{}".

This way of formatting is not expected for those of us who work with Java. Eclipse does well in this regard.

✅ correct - This is how Eclipse does it. It doesn't matter how messy the code is. It will leave it like this:

Correct Preview
image

I have tried countless things, none of them worked.

This has worked since 2007 in eclipse. We are in 2024. As an example of a good format:
image

How do you solve this problem and get the correct form, like correct or equal to eclipse?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện hành vi định dạng dấu ngoặc nhọn và ngắt dòng trong Java VS Code extension bằng các ví dụ và ảnh chụp màn hình trong báo cáo, sau đó so sánh đầu ra với Eclipse. Truy vết hành vi của formatter từ điểm vào định dạng Java của extension và xác định liệu khác biệt là do cấu hình hay do triển khai. Hoàn thành khi các bố cục được báo cáo được chuẩn hóa thành kết quả theo kiểu Eclipse như mong đợi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java, vscode
Lĩnh vực
tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.