Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPython ?/?? output doesn't render nicely in the text editor #200263

Open
1 of 2 tasks
maximlt opened this issue Dec 5, 2022 · 6 comments
Open
1 of 2 tasks

IPython ?/?? output doesn't render nicely in the text editor #200263

maximlt opened this issue Dec 5, 2022 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug notebook-output

Comments

@maximlt
Copy link

maximlt commented Dec 5, 2022

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

IPython provides ? and ?? to get a quick access to the help and source code of an object. When the output of this magic command is too long VSCode suggests opening it in a text editor (Output exceeds the size limit. Open the full output data in a text editor). However, I believe that IPython expects the output to be displayed in a terminal and as such colorizes it. This doesn't render nicely at all in the text editor.

Execute the following in a Notebook cell:

import string
string??

image

Follow the suggestion and open the text editor, you'll see:
image

(Originally reported in holoviz/hvplot#984)

VS Code Version

Version: 1.73.1 (Universal) Commit: 6261075 Date: 2022-11-09T02:08:38.961Z Electron: 19.0.17 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Darwin x64 21.4.0 Sandboxed: No

Jupyter Extension Version

v2022.9.1303220346

Jupyter logs

No response

Coding Language and Runtime Version

No response

Language Extension Version (if applicable)

No response

Anaconda Version (if applicable)

No response

Running Jupyter locally or remotely?

None

@ZeroRin
Copy link

ZeroRin commented Dec 6, 2022

This applies to other colored outputs as well, not limited to ?

@maximlt
Copy link
Author

maximlt commented Dec 6, 2022

I assume so but that should be confirmed.

@ZeroRin
Copy link

ZeroRin commented Dec 6, 2022

Similar problem with exception outputs can be found here
I also tested with printing colored texts directly, the result is same

@DanielHabenicht
Copy link

Ohh yes, I would be forever grateful if someone could fix this. Its driving me nuts.
This is especially pronounced if one does not want to output long text (or inspect something, as raised in this issue) but actually runs into an error message:

image

Which translates to this very readable error message:

image

@amunozj
Copy link

amunozj commented Apr 12, 2023

Still having this problem, any solutions. The full output is completely unreadable. Thank you!

@amunger
Copy link
Contributor

amunger commented Dec 7, 2023

being able to view outputs in a scrollable region should help with this (toggle with ctrl+K, Y by default)

It is surprisingly hard to fix the 'open in separate file link', but we should be able to strip out these extra characters in the copy output command as we do for error outputs.

@amunger amunger transferred this issue from microsoft/vscode-jupyter Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug notebook-output
Projects
None yet
Development

No branches or pull requests

5 participants