diff --git a/extensions/notebook-renderers/src/stackTraceHelper.ts b/extensions/notebook-renderers/src/stackTraceHelper.ts index 20235787cc0..dbab8718f94 100644 --- a/extensions/notebook-renderers/src/stackTraceHelper.ts +++ b/extensions/notebook-renderers/src/stackTraceHelper.ts @@ -37,8 +37,7 @@ const cellRegex = /(Cell\s+(?:\u001b\[.+?m)?In\s*\[(\d+)\])(,\s*line \d+)/; const inputRegex = /(Input\s+?(?:\u001b\[.+?m)In\s*\[(\d+)\])(.*?)/; function isIpythonStackTrace(stack: string) { - // at least one group will point to the Cell within the notebook - return cellRegex.test(stack); + return cellRegex.test(stack) || inputRegex.test(stack) || fileRegex.test(stack); } function stripFormatting(text: string) { diff --git a/extensions/notebook-renderers/src/test/stackTraceHelper.test.ts b/extensions/notebook-renderers/src/test/stackTraceHelper.test.ts index d3350292403..59404c78633 100644 --- a/extensions/notebook-renderers/src/test/stackTraceHelper.test.ts +++ b/extensions/notebook-renderers/src/test/stackTraceHelper.test.ts @@ -46,9 +46,8 @@ suite('StackTraceHelper', () => { '\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'; const formatted = formatStackTrace(stack); - assert.ok(formatted.indexOf('Input [2]') > 0, formatted); - assert.ok(formatted.indexOf('2') > 0, formatted); - assert.ok(formatted.indexOf('2') > 0, formatted); + assert.ok(formatted.indexOf('Input In [2]') > 0, formatted); + assert.ok(formatted.indexOf('2') > 0, formatted); }); test('IPython stack trace lines without associated location are not linkified', () => {