From 32f816c8324e27995f9241e1fc45f5693052d849 Mon Sep 17 00:00:00 2001 From: Aaron Munger Date: Tue, 17 Sep 2024 15:01:33 -0700 Subject: [PATCH] try delegating even if we cannot get the full info (#16057) --- 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..99ff4cfa170 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.warn('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); }