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

fix open data viewer from debug variables window #15062

Merged
merged 5 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Commands as DSCommands, CommandSource } from './platform/common/constan
import { PythonEnvironment } from './platform/pythonEnvironments/info';
import { Channel } from './platform/common/application/types';
import { IJupyterVariable } from './kernels/variables/types';
import { IShowDataViewerFromVariablePanel } from './messageTypes';

export type CommandIds = keyof ICommandNameArgumentTypeMapping;

Expand Down Expand Up @@ -178,7 +179,7 @@ export interface ICommandNameArgumentTypeMapping {
[DSCommands.EnableLoadingWidgetsFrom3rdPartySource]: [];
[DSCommands.NotebookEditorExpandAllCells]: [];
[DSCommands.NotebookEditorCollapseAllCells]: [];
[DSCommands.ShowDataViewer]: [IJupyterVariable];
[DSCommands.ShowDataViewer]: [IJupyterVariable | IShowDataViewerFromVariablePanel];
[DSCommands.RefreshDataViewer]: [];
[DSCommands.ClearSavedJupyterUris]: [];
[DSCommands.RunByLine]: [NotebookCell];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ suite('DataViewer @webview', function () {
await vscode.commands.executeCommand('workbench.debug.viewlet.action.removeAllBreakpoints');
});
// Start debugging using the python extension
test.skip('Open from Python debug variables', async () => {
test('Open from Python debug variables', async () => {
// First off, open up our python test file and make sure editor and groups are how we want them
const textDocument = await openFile(testPythonFile);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ mySet = {1, 2, 3}
});

// Test opening data viewers while another dataviewer is open
test.skip('Open dataviewer', async function () {
test('Open dataviewer', async function () {
// Send the command to open the view
await commands.executeCommand(Commands.OpenVariableView);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { IDataViewerDependencyService, IDataViewerFactory, IJupyterVariableDataP
import { PythonEnvironment } from '../../../platform/pythonEnvironments/info';
import { IKernelProvider } from '../../../kernels/types';
import { IInteractiveWindowProvider } from '../../../interactive-window/types';
import { IShowDataViewerFromVariablePanel } from '../../../messageTypes';

@injectable()
export class DataViewerCommandRegistry implements IExtensionSyncActivationService {
Expand Down Expand Up @@ -72,7 +73,8 @@ export class DataViewerCommandRegistry implements IExtensionSyncActivationServic
const disposable = commands.registerCommand(command, callback, this);
this.disposables.push(disposable);
}
private async onVariablePanelShowDataViewerRequest(request: IJupyterVariable) {
private async onVariablePanelShowDataViewerRequest(request: IJupyterVariable | IShowDataViewerFromVariablePanel) {
const requestVariable = 'variable' in request ? request.variable : request;
sendTelemetryEvent(EventName.OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_REQUEST);
if (
this.debugService?.activeDebugSession &&
Expand All @@ -96,7 +98,7 @@ export class DataViewerCommandRegistry implements IExtensionSyncActivationServic
}

const variable = convertDebugProtocolVariableToIJupyterVariable(
request as unknown as DebugProtocol.Variable
requestVariable as unknown as DebugProtocol.Variable
);
const jupyterVariable = await this.variableProvider.getFullVariable(variable);
const jupyterVariableDataProvider = await this.jupyterVariableDataProviderFactory.create(
Expand All @@ -122,11 +124,11 @@ export class DataViewerCommandRegistry implements IExtensionSyncActivationServic
if (activeKernel && this.jupyterVariableDataProviderFactory && this.dataViewerFactory) {
// Create a variable data provider and pass it to the data viewer factory to create the data viewer
const jupyterVariableDataProvider = await this.jupyterVariableDataProviderFactory.create(
request,
requestVariable,
activeKernel
);

const title: string = `${DataScience.dataExplorerTitle} - ${request.name}`;
const title: string = `${DataScience.dataExplorerTitle} - ${requestVariable.name}`;
return await this.dataViewerFactory.create(jupyterVariableDataProvider, title);
}
} catch (e) {
Expand Down
Loading