chanced / jsonptr

JSON Pointer (RFC 6901) implementation for Rust
Apache License 2.0
44 stars 4 forks source link

Fix debug visualization in vscode for `Pointer` #74

Open chanced opened 1 month ago

chanced commented 1 month ago

Currently this:

let ptr = jsonptr::Pointer::from_static("/example");
let path = std::path::Path::new("/example");

is displayed as:

Screenshot 2024-10-03 at 9 42 55 AM
chanced commented 1 month ago

I haven't been able to get even a simple definition, such as the following spike, to display:

#![debugger_visualizer(natvis_file = "Pointer.natvis")]

#[cfg_attr(not(doc), repr(transparent))]
#[derive(Debug)]
pub struct Spike {
    inner: str,
}
<!-- Pointer.natvis -->
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
    <Type Name="spike::Spike">
      <DisplayString>{inner}</DisplayString>
    </Type>
</AutoVisualizer>

I also can't seem to find the definition for std::path::Path so I guess it is generated somewhere.

chanced commented 1 month ago

I have a question on the forums here about it: https://users.rust-lang.org/t/natvis-for-a-str-newtype/119173

chanced commented 3 weeks ago

It seems Natvis is specific to Windows. I have no idea if it is possible to fix the debug output in vs code on linux/mac.. or windows, for that matter.