question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ANSI/VT100 escape sequences aren't rendered properly

See original GitHub issue

Environment data

  • VS Code version: 1.52-insiders
  • Jupyter Extension version (available under the Extensions sidebar): v2020.11.399280825
  • Python Extension version (available under the Extensions sidebar): N/A
  • OS (Windows | Mac | Linux distro) and version: Win10
  • Python and/or Anaconda version: XXX
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): XXX
  • Jupyter server running: Local | Remote | N/A

Expected behaviour

“Done!” should be green.

Actual behaviour

image

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Install .NET Interactive kernels
  2. Open this notebook:
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": "\r\n<div>\r\n    <div id='dotnet-interactive-this-cell-88188.fd528a8447a84b009c2f638f12c99c47' style='display: none'>\r\n        The below script needs to be able to find the current output cell; this is an easy method to get it.\r\n    </div>\r\n    <script type='text/javascript'>\r\n// ensure `require` is available globally\r\nif (typeof require !== typeof Function || typeof require.config !== typeof Function) {\r\n    let require_script = document.createElement('script');\r\n    require_script.setAttribute('src', 'https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js');\r\n    require_script.setAttribute('type', 'text/javascript');\r\n    require_script.onload = function () {\r\n        loadDotnetInteractiveApi();\r\n    };\r\n\r\n    document.getElementsByTagName('head')[0].appendChild(require_script);\r\n}\r\nelse {\r\n    loadDotnetInteractiveApi();\r\n}\r\n\r\nasync function probeAddresses(probingAddresses) {\r\n    function timeout(ms, promise) {\r\n        return new Promise(function (resolve, reject) {\r\n            setTimeout(function () {\r\n                reject(new Error('timeout'))\r\n            }, ms)\r\n            promise.then(resolve, reject)\r\n        })\r\n    }\r\n\r\n    if (Array.isArray(probingAddresses)) {\r\n        for (let i = 0; i < probingAddresses.length; i++) {\r\n\r\n            let rootUrl = probingAddresses[i];\r\n\r\n            if (!rootUrl.endsWith('/')) {\r\n                rootUrl = `${rootUrl}/`;\r\n            }\r\n\r\n            try {\r\n                let response = await timeout(1000, fetch(`${rootUrl}discovery`, {\r\n                    method: 'POST',\r\n                    cache: 'no-cache',\r\n                    mode: 'cors',\r\n                    timeout: 1000,\r\n                    headers: {\r\n                        'Content-Type': 'text/plain'\r\n                    },\r\n                    body: probingAddresses[i]\r\n                }));\r\n\r\n                if (response.status == 200) {\r\n                    return rootUrl;\r\n                }\r\n            }\r\n            catch (e) { }\r\n        }\r\n    }\r\n}\r\n\r\nfunction loadDotnetInteractiveApi() {\r\n    probeAddresses([\"http://100.112.236.39:1002/\", \"http://127.0.0.1:1002/\"])\r\n        .then((root) => {\r\n            // use probing to find host url and api resources\r\n            // load interactive helpers and language services\r\n            let dotnet_require = require.config({\r\n                context: '88188.fd528a8447a84b009c2f638f12c99c47',\r\n                paths: {\r\n                    'dotnet-interactive': `${root}resources`\r\n                }\r\n            }) || require;\r\n            if (!window.dotnet_require) {\r\n                window.dotnet_require = dotnet_require;\r\n            }\r\n        \r\n            dotnet_require([\r\n                    'dotnet-interactive/dotnet-interactive'\r\n                ],\r\n                function (dotnet) {\r\n                    dotnet.init(window);\r\n                },\r\n                function (error) {\r\n                    console.log(error);\r\n                }\r\n            );\r\n        })\r\n        .catch(error => {console.log(error);});\r\n    }\r\n    </script>\r\n</div>"
     },
     "metadata": {
      "transient": {
       "display_id": "4a1ae2b7-2ff4-42da-9d7b-5727c36de68e"
      }
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[92masdf\u001b[0m\n"
     ]
    }
   ],
   "source": [
    "Write-Host \"asdf\" -ForegroundColor Green"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".NET (PowerShell)",
   "name": ".net-powershell"
  },
  "language_info": {
   "file_extension": ".ps1",
   "mimetype": "text/x-powershell",
   "name": "PowerShell",
   "pygments_lexer": "powershell",
   "version": "7.0"
  },
  "orig_nbformat": 2
 },
 "nbformat": 4,
 "nbformat_minor": 2
}

Logs

Output for Jupyter in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Jupyter)

XXX

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
DonJayamannecommented, Dec 9, 2020
1reaction
DonJayamannecommented, Dec 9, 2020

Aaah yes that’s right. I thought we do use rich output type, might need to have another look into this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make win32 console recognize ANSI/VT100 escape ...
The Win32 console does not natively support ANSI escape sequences at all. Software such as Ansicon can however act as a wrapper around...
Read more >
Chapter 3 Programmer Information - VT100.net
* The last character of the escape sequence is a lowercase L (1548). NOTE: In ANSI mode, if the codes are echoed back...
Read more >
ANSI escape code - Wikipedia
ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals...
Read more >
Enable ANSI/VT100 Escape Sequences (Windows 10)
In this short video I show you how to enable ANSI / VT100 escape sequences to be used on Windows 10. You may...
Read more >
VT100 Terminal Control Escape Sequences
Several terminal specifications are based on the ANSI colour standard, including VT100. The following is a partial listing of the VT100 control set....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found