Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try delegating even if we cannot get the full info #16057

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/kernels/variables/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

import { DebugProtocol } from 'vscode-debugprotocol';
import { IJupyterVariable } from './types';

export const DataViewableTypes: Set<string> = new Set<string>([
'DataFrame',
Expand All @@ -14,7 +15,7 @@ export const DataViewableTypes: Set<string> = new Set<string>([
'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`
Expand Down
1 change: 1 addition & 0 deletions src/kernels/variables/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface IJupyterVariable {
indexColumn?: string;
maximumRowChunkSize?: number;
fileName?: Uri;
frameId?: number;
}

export const IJupyterVariables = Symbol('IJupyterVariables');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class DataViewerDelegator {
): { extension: Extension<unknown>; 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);
}

Expand Down
Loading