Description
This issue has been discussed in #827 and #366, but it remains partially unresolved.
Problem and Previous solution
When debugging ndarray
arrays in VSCode, their display is often not human-readable:
However, with this custom formatter.py file (along with some additional configuration), the display becomes much more readable:
(This solution was originally provided by @MartinRJDagleish in this comment)
More Discussion
The #[debugger_visualizer]
attribute has been stabalized in Rust 1.71.0 for 2 years, which can be used to embed a debugger visualizer file into the debug information. This means we can write pretty-printer files (Python script, for GDB and LLDB) and .natvis
files (for Windbg) for ndarray
arrays, and embed them into the Rust code using the attribute, to provide official support for debugger visualization of ndarray
arrays.
I'm not sure whether it is a feasible approach, but I'm glad to have a discussion.
Relevant Links
-
The Rust Reference: Some examples to use
#[debugger_visualizer]
attribute. -
Rust Compiler Development Guide: Describes the underlying implement in Rust compiler.