microsoft / microsoft/vscode-java-debug

Add Support For Showing a Custom Type View via TypeCustomDebugDataView or Annotations

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

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

ai-triaged enhancement feature request variables
Ngôn ngữ chính
TypeScript
Star
591
Fork
429
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
19

Mô tả

Hi,

It seems currently vscode-java-debug doesn't support a way to have different representations of a type during debug in inline view, "variables" and "watch" windows.

Environment
  • Operating System: Windows 10 19043.1645 (x64)
  • JDK version: Java 11 (Oracle JDK 16)
  • Visual Studio Code version: 1.66.2
  • Java extension version: 1.6.0
  • Java Debugger extension version: 0.40.1
Steps To Reproduce
  1. Start a debugging session in vscode for any java file.
  2. See how class variables are represented in inline-view, "variables" and "watch" windows.
Current Result

For example, here is how it looks like during debug - inline view (extension version v0.40.1):
current-inline-view

and here is overridden toString method in the Point class:
point-ovirridden

notice, I have the following options in .vscode/settings.json:

{
  "java.debug.settings.showQualifiedNames": false,
  "java.debug.settings.showToString": true,
  "java.debug.settings.showLogicalStructure": true
}

also, when I expand an array in the variable view, the nested types are not showing until I click(...):
array-list-expanded-view

It seems there are no ways to enable a custom data view for a particular types, right?

Expected Result

It would be cool to have something like that:
inline-view-expected

It seems like it can be done using either:

  1. Adding an option to enable displaying a result of overridden toString method, e.g. java.debug.settings.showToStringInlineView: true
  2. Add "Java Type Renderer" to support custom data views similar to IntellijIdea "debugger -> Customize Data Views -> Java Type Renderer" (see link #1 in Additional Informations)
  3. Add something like DebuggerDisplay annotation similar to C# DebuggerDisplayAttribute (see link #2 in Additional Informatins)

For me the second way seems more appealing because it may allow setting custom debug views even for Java internal classes like java.utils.ArrayList

Additional Informations

For example, here are some StackOverflow questions that illustrate the problem:

  1. IntelliJ change toString for debug mode (variables view) | StackOverflow
  2. Display custom string in debugger variables | StackOverflow

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

Không có tệp nguồn, bài kiểm thử hoặc điểm vào nào được nêu tên. Hãy bắt đầu bằng cách truy vết cách vscode-java-debug hiển thị các giá trị trong các chế độ xem inline, Variables và Watch, sau đó so sánh các cách tiếp cận TypeCustomDebugDataView, annotation và toString được đề xuất. Được xem là hoàn tất khi có một thiết kế đã được thống nhất và hỗ trợ các biểu diễn kiểu tùy chỉnh trên các chế độ xem được yêu cầu.

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, typescript
Lĩnh vực
devtools
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
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
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.