Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>StructVisualizerNew to Visual Studio Code? Get it now.
StructVisualizer

StructVisualizer

Cristian Daminescu

|
123 installs
| (1) | Free
Parse and visualize C struct memory layout with alignment, padding, pointers, and packing control
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

StructVisualizer

Parse and visualize C/C++ struct memory layout with alignment, padding, pointers, and packing control.

Features

  • Right-click any struct in a C/C++ file → "Visualize Struct"
  • Memory layout visualization:
    • 8-byte rows (configurable via packing)
    • Color-coded fields:
      • 🟢 Light green: normal data
      • 🔵 Light blue: pointers
      • 🟣 Plum: function pointers
      • 🔴 Red ("PAD"): padding bytes
  • Bit-field support with vertical label stacking
  • Byte-width slider for zoom control
  • Automatic type resolution using VS Code's C/C++ extension (cpptools)
  • Macro resolution - automatically resolves #define macros in array sizes
  • Typedef chain resolution - follows typedef chains to underlying types
  • User-configurable exclusion paths to avoid build/backup files
  • Manual type definition fallback for unresolved types
  • "Add Struct to JSON" to save computed size/alignment

Requirements

  • VS Code 1.80.0 or higher
  • C/C++ extension (for type resolution)

No Python installation required! Everything runs natively in TypeScript.

Usage

  1. Open a .c or .h file
  2. Place cursor inside a struct or typedef struct
  3. Right-click → "Visualize Struct"
  4. Adjust packing or zoom as needed

Macro Support

StructVisualizer automatically resolves macros used in array sizes:

#define BUFFER_SIZE 256

struct Data {
    char buffer[BUFFER_SIZE];  // Automatically resolved to buffer[256]
};

When you visualize a struct from the editor, macros are automatically resolved using IntelliSense.

Settings

Configure StructVisualizer in VS Code Settings:

  • struct-visualizer.defaultPack (default: 4):
    Default packing value in bytes (0 = natural alignment)

  • struct-visualizer.defaultByteWidth (default: 60):
    Default byte width in pixels for visualization (range: 40-400)

  • struct-visualizer.typeResolver.excludePaths:
    Array of globs to exclude when resolving types (e.g., ["**/build/**", "**/*.bak"])

Recent Updates

Version 0.3.0

  • Complete TypeScript Migration: No Python dependency - runs natively in VS Code
  • Auto-resolved Type Management: Auto-resolved typedef structs are cleared on each visualization to ensure fresh resolution
  • Comment Stripping: Automatically removes comments (//, ///, /* */) from code before visualization
  • Webview Panel Reuse: Reuses existing panel when visualizing from context menu
  • Typedef Struct Resolution: Automatically computes size/alignment for typedef structs
  • Enhanced Macro Resolution: Handles parentheses and type suffixes (e.g., (5u), 10UL)
  • File Search Fallback: Searches current file when IntelliSense can't resolve types
  • User-Friendly UI: Renamed "Add to JSON" → "Add to Types", status bar visible across all tabs
  • Configurable Defaults: Extension settings for default pack and byte width values

Built for embedded and systems developers who need to verify struct memory layout.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft