diff --git a/news/2 Fixes/10204.md b/news/2 Fixes/10204.md new file mode 100644 index 000000000000..8456ecbf29c5 --- /dev/null +++ b/news/2 Fixes/10204.md @@ -0,0 +1 @@ +Fix empty variables to show an empty string in the Notebook/Interactive Window variable explorer. \ No newline at end of file diff --git a/src/client/datascience/jupyter/jupyterVariables.ts b/src/client/datascience/jupyter/jupyterVariables.ts index a765f1cd2c45..35620498a1a9 100644 --- a/src/client/datascience/jupyter/jupyterVariables.ts +++ b/src/client/datascience/jupyter/jupyterVariables.ts @@ -32,7 +32,7 @@ import { JupyterDataRateLimitError } from './jupyterDataRateLimitError'; // kernels will add the ansi encoding. const TypeRegex = /.*?\[.*?;31mType:.*?\[0m\s+(\w+)/; const ValueRegex = /.*?\[.*?;31mValue:.*?\[0m\s+(.*)/; -const StringFormRegex = /.*?\[.*?;31mString form:.*?\[0m\s+([\s\S]+?)\n.*?\[.*?/; +const StringFormRegex = /.*?\[.*?;31mString form:.*?\[0m\s*?([\s\S]+?)\n(.*\[.*;31m?)/; const DocStringRegex = /.*?\[.*?;31mDocstring:.*?\[0m\s+(.*)/; const CountRegex = /.*?\[.*?;31mLength:.*?\[0m\s+(.*)/; const ShapeRegex = /^\s+\[(\d+) rows x (\d+) columns\]/m; diff --git a/src/test/datascience/jupyterVariables.unit.test.ts b/src/test/datascience/jupyterVariables.unit.test.ts index 11924dcb9c86..893bbba9e646 100644 --- a/src/test/datascience/jupyterVariables.unit.test.ts +++ b/src/test/datascience/jupyterVariables.unit.test.ts @@ -302,7 +302,7 @@ This is equivalent to (real + imag*1j) where imag defaults to 0. truncated: true, count: 0, shape: '', - value: '(1+1j)', + value: ' (1+1j)', supportsDataExplorer: false };