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

improve rendering for stack traces produced by jupyter #195578

Closed
Tracked by #195579
amunger opened this issue Oct 13, 2023 · 1 comment · Fixed by #195743
Closed
Tracked by #195579

improve rendering for stack traces produced by jupyter #195578

amunger opened this issue Oct 13, 2023 · 1 comment · Fixed by #195743
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders notebook-builtin-renderers Builtin notebook output renderers for HTML, JS and images verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@amunger
Copy link
Contributor

amunger commented Oct 13, 2023

create a new untitled text file and paste the contents below
save the file as an .ipynb, then reopen with the notebook editor

🐛 ugly highlighting

file contents:

{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "4ffd48ad",
   "metadata": {},
   "outputs": [],
   "source": [
    "def myfunc():\n",
    "    print(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "4e5233d0",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'x' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[2], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mmyfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
      "Cell \u001b[1;32mIn[1], line 2\u001b[0m, in \u001b[0;36mmyfunc\u001b[1;34m()\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mmyfunc\u001b[39m():\n\u001b[1;32m----> 2\u001b[0m     \u001b[38;5;28mprint\u001b[39m(\u001b[43mx\u001b[49m)\n",
      "\u001b[1;31mNameError\u001b[0m: name 'x' is not defined"
     ]
    }
   ],
   "source": [
    "myfunc()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "9e909fcf",
   "metadata": {},
   "outputs": [
    {
     "ename": "Exception",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mException\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[3], line 2\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmyLib\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m \u001b[43mmyLib\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mthrowEx\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[1;32mC:\\venvs\\myLib.py:2\u001b[0m, in \u001b[0;36mthrowEx\u001b[1;34m()\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mthrowEx\u001b[39m():\n\u001b[1;32m----> 2\u001b[0m     \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m\n",
      "\u001b[1;31mException\u001b[0m: "
     ]
    }
   ],
   "source": [
    "import myLib\n",
    "myLib.throwEx()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3a49607b",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}

@amunger amunger added the notebook-builtin-renderers Builtin notebook output renderers for HTML, JS and images label Oct 13, 2023
@amunger amunger self-assigned this Oct 13, 2023
@vscodenpa vscodenpa added the unreleased Patch has not yet been released in VS Code Insiders label Oct 19, 2023
@vscodenpa vscodenpa added this to the October 2023 milestone Oct 19, 2023
@vscodenpa vscodenpa added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Oct 20, 2023
@amunger amunger added bug Issue identified by VS Code Team member as probable bug feature-request Request for new features or functionality labels Oct 23, 2023
@amunger
Copy link
Contributor Author

amunger commented Oct 23, 2023

alternative verification steps:

  1. use the undocumented jupyter setting to disable formatting in the extension "jupyter.formatStackTraces": false
  2. run a notebook cell with an error.
    No ugly highlighting, links are rendered for stack frames

@amunger amunger added the verification-needed Verification of issue is requested label Oct 24, 2023
@mjbvz mjbvz added the verified Verification succeeded label Oct 24, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders notebook-builtin-renderers Builtin notebook output renderers for HTML, JS and images verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants