You're looking for a more comprehensive data viewer in VSCode that can drill down into arbitrary Python objects or data structures, similar to PyCharm's built-in data viewer. While there isn't a single extension that perfectly replicates PyCharm's data viewer, you can try the following options:
- Debug Visualizer: This extension provides a more detailed view of variables during debugging, including support for drilling down into complex data structures. You can install it from the VSCode marketplace.
- Python for VSCode: The official Python extension for VSCode has a built-in Variables panel that can display complex data structures, including lists, dictionaries, and objects. You can access it by clicking on the Variables tab in the Run panel or by using the keyboard shortcut
Ctrl + Shift + D (Windows/Linux) or Cmd + Shift + D (macOS).
- PDB++: PDB++ is a drop-in replacement for the built-in Python debugger (pdb) that provides a more comprehensive data viewer. You can install it using pip:
pip install pdbpp. Then, in your VSCode launch configuration, set the program attribute to pdbpp instead of python.
- Jupyter Notebook Extensions: If you're using Jupyter Notebooks, you can try installing the Jupyter Notebook Extensions package, which includes a Variable Inspector that can display complex data structures.
- Xeus: Xeus is a Jupyter kernel that provides a more comprehensive data viewer, including support for drilling down into complex data structures. You can install it using pip:
pip install xeus. Then, in your VSCode launch configuration, set the kernel attribute to xeus.
To use any of these options, you'll need to:
- Install the relevant extension or package
- Configure your VSCode launch settings to use the new extension or package
- Start a debugging session or run a Jupyter Notebook
Here's an example launch configuration for the Debug Visualizer extension:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"debugVisualizer": true
}
]
}
Keep in mind that each of these options has its own strengths and weaknesses, and you may need to experiment to find the one that best fits your needs.