Open gsnidero opened 1 year ago
This would be incredibly useful! I'm currently writing json to file and then using the vscode's internal json viewer to inspect unknown large json objects or using jq on command-line. Having functionality of the screenshot in the cell output when using display_json
or JSON
would make my whole year ❤️
tly writing json to file and then using the vscode's internal json viewer to inspe
@mjbvz I know this used to be possible ( I distinctly recall testing JSON and collapsing individual nodes),
looks like we're no longer using the built-in editors to display the outputs, instead we use the mardown renderer to render different languages. For instance if you look at the docs you can see selection of code and the like is possible (see screesnshots) https://code.visualstudio.com/api/extension-guides/notebook
@mjbvz Is this deliberate? if so, I think we might want to update the docs (I can file a separate issue for that) & perhaps leave the above request as a feature request
@rebornix Do you remember when this changed? I think it's been this way for a long time now since all output items should go through our output renders apis
@rebornix pinging, if this was removed, we might want to update the docs
We don't have the "monaco-editor" renderer support since we moved all renderers out from core to extensions.
we might want to update the docs
Good call, we should update.
are there any workarounds or extensions for this?
this kind of works, but does not support folding
from IPython.display import Markdown
Markdown(f'```json\n{json.dumps(mydict, indent=2)}\n```')
Kind of workaound for now, install Monaco Editor renderer from extensions manager.
run the code once, and select the 3 dots at the left of the output. select "change presentation"
Select monaco renderer, This is the output and it is collapsible
As an alternative, because i haven't tested this with big Json files, you can use this code
https://gist.github.com/t27/48b3ac73a1479914f9fe9383e5d45325
to generate your own collapsible display function for json data.
Cheers!
Environment data
Expected behaviour
In JupyterLab, when rendering a json output one can control if the data is
extended
or notActual behaviour
In VSCode-jupyter, the
extended
metadata is not usedSteps to reproduce:
Run this on a notebook
Logs
Output for
Jupyter
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toJupyter
)``` nfo 12:27:24.118: Restart requested file:///Users/giacomosnidero/repos/test-tech/Untitled-1.ipynb info 12:27:24.118: Restart kernel execution info 12:27:24.118: Restarting 7aa332df-9114-4368-87e8-7fc5ff4ea0d1 [I 12:27:24.122 NotebookApp] Creating new notebook in info 12:27:24.130: installMissingDependencies /Users/giacomosnidero/.pyenv/versions/3.10.5/envs/test-tech-3.10.5/bin/python, ui.disabled=false for resource '/Users/giacomosnidero/repos/test-tech/Untitled-1.ipynb' info 12:27:24.130: Got env vars with python /Users/giacomosnidero/.pyenv/versions/3.10.5/envs/test-tech-3.10.5/bin/python, with env var count 54 and custom env var count 0 in 0ms info 12:27:24.130: Got env vars ourselves faster /Users/giacomosnidero/.pyenv/versions/3.10.5/envs/test-tech-3.10.5/bin/python with env var count 54 in 0ms info 12:27:24.131: Process Execution: > ~/.pyenv/versions/3.10.5/envs/test-tech-3.10.5/bin/python -c "import ipykernel" > ~/.pyenv/versions/3.10.5/envs/test-tech-3.10.5/bin/python -c "import ipykernel" info 12:27:24.236: Spec argv[0] updated from '/Users/giacomosnidero/.pyenv/versions/3.10.5/envs/test-tech-3.10.5/bin/python' to '/Users/giacomosnidero/.pyenv/versions/3.10.5/envs/test-tech-3.10.5/bin/python' info 12:27:24.237: Got env vars with python /Users/giacomosnidero/.pyenv/versions/3.10.5/envs/test-tech-3.10.5/bin/python, with env var count 54 and custom env var count 0 in 1ms info 12:27:24.237: Got env vars ourselves faster /Users/giacomosnidero/.pyenv/versions/3.10.5/envs/test-tech-3.10.5/bin/python with env var count 54 in 1ms [I 12:27:24.258 NotebookApp] Kernel started: aa976560-51bb-4d4a-93f2-8b32de369622, name: python3105jvsc74a57bd075b429ef1bb511660894b825902db379d3782b7d15b9e72440ff49932a6e89de [W 12:27:24.266 NotebookApp] delete /Untitled-1-jvsc-b6a81cb3-8cb6-4b78-8a5b-f38e49c1dd7ecdbf5b7e-0525-470b-9ca2-ec26e60a722c.ipynb info 12:27:24.691: Got new session aa976560-51bb-4d4a-93f2-8b32de369622 info 12:27:24.691: Started new restart session [I 12:27:24.694 NotebookApp] Kernel shutdown: 7aa332df-9114-4368-87e8-7fc5ff4ea0d1 info 12:27:24.779: Got env vars with python /Users/giacomosnidero/.pyenv/versions/3.10.5/envs/test-tech-3.10.5/bin/python, with env var count 54 and custom env var count 0 in 1ms info 12:27:24.779: Got env vars ourselves faster /Users/giacomosnidero/.pyenv/versions/3.10.5/envs/test-tech-3.10.5/bin/python with env var count 54 in 1ms info 12:27:24.779: Process Execution: > ~/.pyenv/versions/3.10.5/envs/test-tech-3.10.5/bin/python -c "import sys;print(sys.executable)" > ~/.pyenv/versions/3.10.5/envs/test-tech-3.10.5/bin/python -c "import sys;print(sys.executable)" info 12:27:24.780: UpdateWorkingDirectoryAndPath in Kernel ```