From f0cb0bdf199308c5fdbec132381210d31ca67fea Mon Sep 17 00:00:00 2001 From: amunger Date: Tue, 17 Sep 2024 11:55:31 -0700 Subject: [PATCH 1/2] try delegating even if we cannot get the full info --- src/kernels/variables/helpers.ts | 3 ++- src/kernels/variables/types.ts | 1 + .../dataviewer/dataViewerCommandRegistry.ts | 10 ++++++++-- .../extension-side/dataviewer/dataViewerDelegator.ts | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/kernels/variables/helpers.ts b/src/kernels/variables/helpers.ts index 71debcd1c42..8ffc5ef8beb 100644 --- a/src/kernels/variables/helpers.ts +++ b/src/kernels/variables/helpers.ts @@ -2,6 +2,7 @@ // Licensed under the MIT License. import { DebugProtocol } from 'vscode-debugprotocol'; +import { IJupyterVariable } from './types'; export const DataViewableTypes: Set = new Set([ 'DataFrame', @@ -14,7 +15,7 @@ export const DataViewableTypes: Set = new Set([ 'DataArray' ]); -export function convertDebugProtocolVariableToIJupyterVariable(variable: DebugProtocol.Variable) { +export function convertDebugProtocolVariableToIJupyterVariable(variable: DebugProtocol.Variable): IJupyterVariable { return { // If `evaluateName` is available use that. That is the name that we can eval in the debugger // but it's an optional property so fallback to `variable.name` diff --git a/src/kernels/variables/types.ts b/src/kernels/variables/types.ts index 4a40a86c11a..0dc9e2fadfa 100644 --- a/src/kernels/variables/types.ts +++ b/src/kernels/variables/types.ts @@ -25,6 +25,7 @@ export interface IJupyterVariable { indexColumn?: string; maximumRowChunkSize?: number; fileName?: Uri; + frameId?: number; } export const IJupyterVariables = Symbol('IJupyterVariables'); diff --git a/src/webviews/extension-side/dataviewer/dataViewerCommandRegistry.ts b/src/webviews/extension-side/dataviewer/dataViewerCommandRegistry.ts index bfa96b5249f..1a678ba3a10 100644 --- a/src/webviews/extension-side/dataviewer/dataViewerCommandRegistry.ts +++ b/src/webviews/extension-side/dataviewer/dataViewerCommandRegistry.ts @@ -90,7 +90,7 @@ export class DataViewerCommandRegistry implements IExtensionSyncActivationServic private async delegateDataViewer(request: IJupyterVariable | IShowDataViewerFromVariablePanel) { const variable = 'variable' in request ? await this.getVariableFromRequest(request) : request; if (!variable) { - logger.error('Full variable info could not be retreived'); + logger.error('Variable info could not be retreived'); sendTelemetryEvent(Telemetry.FailedShowDataViewer, undefined, { reason: 'no variable info', fromVariableView: false @@ -106,7 +106,13 @@ export class DataViewerCommandRegistry implements IExtensionSyncActivationServic const variable = convertDebugProtocolVariableToIJupyterVariable( request.variable as unknown as DebugProtocol.Variable ); - return this.variableProvider.getFullVariable(variable); + try { + const result = await this.variableProvider.getFullVariable(variable); + return result; + } catch (e) { + logger.error('Full variable info could not be retreived, will attempt with partial info.', e); + return variable; + } } } diff --git a/src/webviews/extension-side/dataviewer/dataViewerDelegator.ts b/src/webviews/extension-side/dataviewer/dataViewerDelegator.ts index 67efbdd8eab..7569dbd0567 100644 --- a/src/webviews/extension-side/dataviewer/dataViewerDelegator.ts +++ b/src/webviews/extension-side/dataviewer/dataViewerDelegator.ts @@ -90,7 +90,7 @@ export class DataViewerDelegator { ): { extension: Extension; jupyterVariableViewers: IVariableViewer }[] { const variableViewers = this.getVariableViewers(); return variableViewers - .filter((d) => d.jupyterVariableViewers.dataTypes.includes(variable.type)) + .filter((d) => !variable.type || d.jupyterVariableViewers.dataTypes.includes(variable.type)) .filter((e) => e.extension.id !== JVSC_EXTENSION_ID); } From ef96cae9353031959bbdf24f4088fa8082baf498 Mon Sep 17 00:00:00 2001 From: amunger Date: Tue, 17 Sep 2024 14:29:15 -0700 Subject: [PATCH 2/2] just a warning --- .../extension-side/dataviewer/dataViewerCommandRegistry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webviews/extension-side/dataviewer/dataViewerCommandRegistry.ts b/src/webviews/extension-side/dataviewer/dataViewerCommandRegistry.ts index 1a678ba3a10..99ff4cfa170 100644 --- a/src/webviews/extension-side/dataviewer/dataViewerCommandRegistry.ts +++ b/src/webviews/extension-side/dataviewer/dataViewerCommandRegistry.ts @@ -110,7 +110,7 @@ export class DataViewerCommandRegistry implements IExtensionSyncActivationServic const result = await this.variableProvider.getFullVariable(variable); return result; } catch (e) { - logger.error('Full variable info could not be retreived, will attempt with partial info.', e); + logger.warn('Full variable info could not be retreived, will attempt with partial info.', e); return variable; } }