Skip to content
| Marketplace
Sign in
Visual Studio Code>Debuggers>Save Debug Variable to FileNew to Visual Studio Code? Get it now.
Save Debug Variable to File

Save Debug Variable to File

Felipe Maza

|
1 install
| (0) | Free
Save the full value of a debug variable to a file from the Variables view context menu. Dumps numpy arrays, xarray datasets and pandas objects without truncation, one value per line.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Save Debug Variable to File

Adds "Save Value to File..." and "Copy Full Value to Clipboard" options to the context menu of the debugger's Variables view.

Usage

  1. Start a debug session and stop at a breakpoint.
  2. In Run and Debug → Variables, right-click a variable.
  3. Choose Save Value to File... (pick where to save it) or Copy Full Value to Clipboard (same content, ready to paste, e.g. as a column in Excel).

How the value is obtained

  • Python sessions (debugpy): serialization runs inside the debugged process, which writes the file directly. Nothing is truncated:
    • numpy.ndarray → one value per line (flattened in C order), ready to paste as a column in Excel
    • xarray DataArray → values only, one per line; Dataset → one section per coordinate/variable, one value per line
    • pandas → to_string()
    • anything else → repr()
  • Other languages: a "Copy Value"-style evaluation (context: 'clipboard'); falls back to the value shown in the view.

Notes

  • Arrays with millions of elements produce huge text files and take a while; that is the cost of the text format.
  • With remote debugging, the Python process writes on its machine: the chosen path must exist there.

Credits

Code developed by Claude Fable (Anthropic's AI model).

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