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 export to python script not appearing #5407

Merged
merged 4 commits into from
Apr 5, 2021
Merged
Changes from 1 commit
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
5 changes: 1 addition & 4 deletions src/client/datascience/commands/exportCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

'use strict';

import { nbformat } from '@jupyterlab/coreutils';
import { inject, injectable } from 'inversify';
import { QuickPickItem, QuickPickOptions, Uri } from 'vscode';
import { getLocString } from '../../../datascience-ui/react-common/locReactSide';
Expand All @@ -17,7 +16,6 @@ import { sendTelemetryEvent } from '../../telemetry';
import { Commands, Telemetry } from '../constants';
import { ExportManager } from '../export/exportManager';
import { ExportFormat, IExportManager } from '../export/types';
import { isPythonNotebook } from '../notebook/helpers/helpers';
import { INotebookEditorProvider } from '../types';

interface IExportQuickPickItem extends QuickPickItem {
Expand Down Expand Up @@ -125,9 +123,8 @@ export class ExportCommands implements IDisposable {
interpreter?: PythonEnvironment
): IExportQuickPickItem[] {
const items: IExportQuickPickItem[] = [];
const notebook = JSON.parse(contents) as nbformat.INotebookContent;

if (notebook.metadata && isPythonNotebook(notebook.metadata)) {
if (interpreter) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we don't have the python extension installed?

I think this would be better off being an or with the previous condition.

items.push({
label: DataScience.exportPythonQuickPickLabel(),
picked: true,
Expand Down