Creating "visualizers" for my types in C++ for vscode debugger

Viewed 484

In the instruction (https://code.visualstudio.com/docs/cpp/launch-json-reference) I see that VSCode can use a ".natvis" file. It then refers to docs from Visual Studio, so most of the usage information does not apply but there is a rather brief section on the syntax of the file.

  • It says that "Natvis customizations work with classes and structs, but not typedefs." but what is the situation with using type aliases? The type shown to me in the Variables pane does involve using to create the name that the code subsequently consumes, though it's actually defined in internal namespaces and template aliases. Do I need to unravel the name as it would be without any usings?

  • It gives a simple example of a template, but that example uses a type argument and only one template argument. What about non-type arguments? Does the * work on the string of the name to match or only on individual components of the name?

    template <int S, int F>
    class Decimal { ... };
    
  • The information about turning on diagnostics in Visual Studio 2019 (on Windows!) is completely irrelevant to VSCode. How do I troubleshoot?

  • As noted above, I have a Decimal class that represents fixed-point numbers in integers. How can I craft the output I want when functions can't be called? String manipulation would work, once the integer member (field) is formed into a string for display, I need merely insert a decimal point at Fth position from the right.

0 Answers
Related