Skip to content

Commit cc73640

Browse files
authored
Fix messed up regex to account for empty string form (#10307)
* Fix messed up regex to account for empty string form * Fix unit test
1 parent b0ded20 commit cc73640

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

news/2 Fixes/10204.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix empty variables to show an empty string in the Notebook/Interactive Window variable explorer.

src/client/datascience/jupyter/jupyterVariables.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { JupyterDataRateLimitError } from './jupyterDataRateLimitError';
3232
// kernels will add the ansi encoding.
3333
const TypeRegex = /.*?\[.*?;31mType:.*?\[0m\s+(\w+)/;
3434
const ValueRegex = /.*?\[.*?;31mValue:.*?\[0m\s+(.*)/;
35-
const StringFormRegex = /.*?\[.*?;31mString form:.*?\[0m\s+([\s\S]+?)\n.*?\[.*?/;
35+
const StringFormRegex = /.*?\[.*?;31mString form:.*?\[0m\s*?([\s\S]+?)\n(.*\[.*;31m?)/;
3636
const DocStringRegex = /.*?\[.*?;31mDocstring:.*?\[0m\s+(.*)/;
3737
const CountRegex = /.*?\[.*?;31mLength:.*?\[0m\s+(.*)/;
3838
const ShapeRegex = /^\s+\[(\d+) rows x (\d+) columns\]/m;

src/test/datascience/jupyterVariables.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ This is equivalent to (real + imag*1j) where imag defaults to 0.
302302
truncated: true,
303303
count: 0,
304304
shape: '',
305-
value: '(1+1j)',
305+
value: ' (1+1j)',
306306
supportsDataExplorer: false
307307
};
308308

0 commit comments

Comments
 (0)