redhat-developer / redhat-developer/vscode-java

Java formatter ignores org.eclipse.jdt.core.formatter.tabulation.size and uses editor's 'tab size' when calculating line split

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

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

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

Mô tả

Java formatter ignores org.eclipse.jdt.core.formatter.tabulation.size and uses editor's 'tab size' when calculating how lines should be split. This makes it difficult for users to use their preferred indentation size without throwing off source control history diffs.

Environment
  • JDK version: openjdk version "17.0.10" 2024-01-16 LTS
  • Visual Studio Code version: 1.86.2
  • Java extension version: 1.28.1
Steps To Reproduce

Relevant settings:

  • Java formatter <setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/> and <setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/> in my java formatter
    (full formatting file: java-formatter.xml.txt))
  • VS Code set to tab size: 4

If I have a line that is 121 characters, the formatter will wrap appropriately. However, if someone else has their tab size:2, the total line length is calculated to be less than 120, and thus will unwrap the lines wich throws off the file history diffs.

Current Result

Line split is calculated based on VS Code's tab size setting, instead of the formatter's tabulation.size

Expected Result

Line split should be calculated based on the tabulation.size setting, to allow users to have their preferred tab size within VS Code

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

Bắt đầu bằng cách tái hiện hành vi của formatter với các thiết lập lineSplit và tabulation.size được cung cấp, đồng thời thay đổi kích thước tab của VS Code. Truy dấu nơi độ dài dòng của Java formatter được tính toán và xác minh kết quả theo Expected Result: việc tách dòng phải sử dụng tabulation.size thay vì kích thước tab của trình soạn thảo.

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
developer-experience, tooling
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/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.