From cab6f77450423cbd972cc63a95b89c469279eabc Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 9 Jul 2020 19:53:18 -0400 Subject: [PATCH 1/7] made export cancellable --- src/client/datascience/export/exportBase.ts | 36 ++++++++++++++++--- .../datascience/export/exportManager.ts | 14 +++++--- src/client/datascience/export/exportToHTML.ts | 6 ++-- src/client/datascience/export/exportToPDF.ts | 6 ++-- .../datascience/export/exportToPython.ts | 7 ++-- src/client/datascience/export/types.ts | 4 +-- .../datascience/progress/progressReporter.ts | 6 ++-- .../datascience/export/exportManager.test.ts | 2 +- .../datascience/export/exportToHTML.test.ts | 5 ++- .../datascience/export/exportToPython.test.ts | 5 ++- 10 files changed, 66 insertions(+), 25 deletions(-) diff --git a/src/client/datascience/export/exportBase.ts b/src/client/datascience/export/exportBase.ts index a5ed31449b51..11b47a577a2e 100644 --- a/src/client/datascience/export/exportBase.ts +++ b/src/client/datascience/export/exportBase.ts @@ -1,5 +1,5 @@ import { inject, injectable } from 'inversify'; -import { Uri } from 'vscode'; +import { CancellationToken, Uri } from 'vscode'; import { IFileSystem } from '../../common/platform/types'; import { IPythonExecutionFactory, IPythonExecutionService } from '../../common/process/types'; import { reportAction } from '../progress/decorator'; @@ -18,26 +18,54 @@ export class ExportBase implements IExport { ) {} // tslint:disable-next-line: no-empty - public async export(_source: Uri, _target: Uri): Promise {} + public async export(_source: Uri, _target: Uri, _token: CancellationToken): Promise {} @reportAction(ReportableAction.PerformingExport) - public async executeCommand(source: Uri, target: Uri, args: string[]): Promise { + public async executeCommand(source: Uri, target: Uri, args: string[], token: CancellationToken): Promise { + if (token.isCancellationRequested) { + return; + } + const service = await this.getExecutionService(source); if (!service) { return; } + if (token.isCancellationRequested) { + return; + } + const oldFileExists = await this.fileSystem.fileExists(target.fsPath); let oldFileTime; if (oldFileExists) { oldFileTime = (await this.fileSystem.stat(target.fsPath)).mtime; } + if (token.isCancellationRequested) { + return; + } + const result = await service.execModule('jupyter', ['nbconvert'].concat(args), { throwOnStdErr: false, - encoding: 'utf8' + encoding: 'utf8', + token: token }); + if (token.isCancellationRequested) { + if (oldFileExists) { + const newFileTime = (await this.fileSystem.stat(target.fsPath)).mtime; + if (newFileTime === oldFileTime) { + await this.fileSystem.deleteFile(target.fsPath); + } + } else { + try { + await this.fileSystem.deleteFile(target.fsPath); + // tslint:disable-next-line: no-empty + } catch {} + } + return; + } + // Need to check if export failed, since throwOnStdErr is not an // indicator of a failed export. if (!(await this.fileSystem.fileExists(target.fsPath))) { diff --git a/src/client/datascience/export/exportManager.ts b/src/client/datascience/export/exportManager.ts index dcfb47f80183..d58367975728 100644 --- a/src/client/datascience/export/exportManager.ts +++ b/src/client/datascience/export/exportManager.ts @@ -51,27 +51,31 @@ export class ExportManager implements IExportManager { await this.exportUtil.removeSvgs(source); } - const reporter = this.progressReporter.createProgressIndicator(`Exporting to ${format}`); + const reporter = this.progressReporter.createProgressIndicator(`Exporting to ${format}`, true); try { switch (format) { case ExportFormat.python: - await this.exportToPython.export(source, target); + await this.exportToPython.export(source, target, reporter.token); break; case ExportFormat.pdf: - await this.exportToPDF.export(source, target); + await this.exportToPDF.export(source, target, reporter.token); break; case ExportFormat.html: - await this.exportToHTML.export(source, target); + await this.exportToHTML.export(source, target, reporter.token); break; default: break; } } finally { - reporter.dispose(); tempDir.dispose(); + reporter.dispose(); + } + + if (reporter.token.isCancellationRequested) { + return; } return target; diff --git a/src/client/datascience/export/exportToHTML.ts b/src/client/datascience/export/exportToHTML.ts index 005addcc4cfc..dbdab0120494 100644 --- a/src/client/datascience/export/exportToHTML.ts +++ b/src/client/datascience/export/exportToHTML.ts @@ -1,11 +1,11 @@ import { injectable } from 'inversify'; import * as path from 'path'; -import { Uri } from 'vscode'; +import { CancellationToken, Uri } from 'vscode'; import { ExportBase } from './exportBase'; @injectable() export class ExportToHTML extends ExportBase { - public async export(source: Uri, target: Uri): Promise { + public async export(source: Uri, target: Uri, token: CancellationToken): Promise { const args = [ source.fsPath, '--to', @@ -15,6 +15,6 @@ export class ExportToHTML extends ExportBase { '--output-dir', path.dirname(target.fsPath) ]; - await this.executeCommand(source, target, args); + await this.executeCommand(source, target, args, token); } } diff --git a/src/client/datascience/export/exportToPDF.ts b/src/client/datascience/export/exportToPDF.ts index 550e4b1c9e67..7257a218387e 100644 --- a/src/client/datascience/export/exportToPDF.ts +++ b/src/client/datascience/export/exportToPDF.ts @@ -1,6 +1,6 @@ import { inject, injectable } from 'inversify'; import * as path from 'path'; -import { Uri } from 'vscode'; +import { CancellationToken, Uri } from 'vscode'; import { IFileSystem } from '../../common/platform/types'; import { IPythonExecutionFactory } from '../../common/process/types'; import { IJupyterSubCommandExecutionService, INotebookImporter } from '../types'; @@ -18,7 +18,7 @@ export class ExportToPDF extends ExportBase { super(pythonExecutionFactory, jupyterService, fileSystem, importer); } - public async export(source: Uri, target: Uri): Promise { + public async export(source: Uri, target: Uri, token: CancellationToken): Promise { const args = [ source.fsPath, '--to', @@ -28,6 +28,6 @@ export class ExportToPDF extends ExportBase { '--output-dir', path.dirname(target.fsPath) ]; - await this.executeCommand(source, target, args); + await this.executeCommand(source, target, args, token); } } diff --git a/src/client/datascience/export/exportToPython.ts b/src/client/datascience/export/exportToPython.ts index 607026982710..58e010ead4f9 100644 --- a/src/client/datascience/export/exportToPython.ts +++ b/src/client/datascience/export/exportToPython.ts @@ -1,10 +1,13 @@ import { injectable } from 'inversify'; -import { Uri } from 'vscode'; +import { CancellationToken, Uri } from 'vscode'; import { ExportBase } from './exportBase'; @injectable() export class ExportToPython extends ExportBase { - public async export(source: Uri, target: Uri): Promise { + public async export(source: Uri, target: Uri, token: CancellationToken): Promise { + if (token.isCancellationRequested) { + return; + } const contents = await this.importer.importFromFile(source.fsPath); await this.fileSystem.writeFile(target.fsPath, contents); } diff --git a/src/client/datascience/export/types.ts b/src/client/datascience/export/types.ts index cb632e57ebc1..07ff4eee7f61 100644 --- a/src/client/datascience/export/types.ts +++ b/src/client/datascience/export/types.ts @@ -1,4 +1,4 @@ -import { Uri } from 'vscode'; +import { CancellationToken, Uri } from 'vscode'; import { INotebookModel } from '../types'; export enum ExportFormat { @@ -14,7 +14,7 @@ export interface IExportManager { export const IExport = Symbol('IExport'); export interface IExport { - export(source: Uri, target: Uri): Promise; + export(source: Uri, target: Uri, token: CancellationToken): Promise; } export const IExportManagerFilePicker = Symbol('IExportManagerFilePicker'); diff --git a/src/client/datascience/progress/progressReporter.ts b/src/client/datascience/progress/progressReporter.ts index 45098c9a0ff8..87ccadf9f450 100644 --- a/src/client/datascience/progress/progressReporter.ts +++ b/src/client/datascience/progress/progressReporter.ts @@ -33,15 +33,15 @@ export class ProgressReporter implements IProgressReporter { * @returns {(IDisposable & { token: CancellationToken })} * @memberof ProgressReporter */ - public createProgressIndicator(message: string): IDisposable & { token: CancellationToken } { + public createProgressIndicator(message: string, cancellable = false): IDisposable & { token: CancellationToken } { const cancellation = new CancellationTokenSource(); const deferred = createDeferred(); - const options = { location: ProgressLocation.Notification, cancellable: false, title: message }; + const options = { location: ProgressLocation.Notification, cancellable: cancellable, title: message }; this.appShell .withProgress(options, async (progress, cancelToken) => { cancelToken.onCancellationRequested(() => { - if (!cancelToken.isCancellationRequested) { + if (cancelToken.isCancellationRequested) { cancellation.cancel(); } deferred.resolve(); diff --git a/src/test/datascience/export/exportManager.test.ts b/src/test/datascience/export/exportManager.test.ts index 359fa59d6ba5..189b823e973d 100644 --- a/src/test/datascience/export/exportManager.test.ts +++ b/src/test/datascience/export/exportManager.test.ts @@ -40,7 +40,7 @@ suite('Data Science - Export Manager', () => { when(exportUtil.generateTempDir()).thenResolve({ path: 'test', dispose: () => {} }); when(exportUtil.makeFileInDirectory(anything(), anything(), anything())).thenResolve('foo'); when(fileSystem.createTemporaryFile(anything())).thenResolve(instance(tempFile)); - when(exportPdf.export(anything(), anything())).thenResolve(); + when(exportPdf.export(anything(), anything(), anything())).thenResolve(); when(filePicker.getExportFileLocation(anything(), anything())).thenResolve(Uri.file('foo')); // tslint:disable-next-line: no-any when(reporter.createProgressIndicator(anything())).thenReturn(instance(mock()) as any); diff --git a/src/test/datascience/export/exportToHTML.test.ts b/src/test/datascience/export/exportToHTML.test.ts index ec1b0b225543..1fcfeeab9773 100644 --- a/src/test/datascience/export/exportToHTML.test.ts +++ b/src/test/datascience/export/exportToHTML.test.ts @@ -3,6 +3,7 @@ // tslint:disable: no-var-requires no-require-imports no-invalid-this no-any import { assert } from 'chai'; +import { CancellationTokenSource } from 'monaco-editor'; import * as path from 'path'; import { Uri } from 'vscode'; import { IFileSystem } from '../../../client/common/platform/types'; @@ -34,9 +35,11 @@ suite('DataScience - Export HTML', () => { const file = await fileSystem.createTemporaryFile('.html'); const target = Uri.file(file.filePath); await file.dispose(); + const token = new CancellationTokenSource(); await exportToHTML.export( Uri.file(path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'src', 'test', 'datascience', 'export', 'test.ipynb')), - target + target, + token.token ); assert.equal(await fileSystem.fileExists(target.fsPath), true); diff --git a/src/test/datascience/export/exportToPython.test.ts b/src/test/datascience/export/exportToPython.test.ts index 0bcf74ab912e..d0ec953d78eb 100644 --- a/src/test/datascience/export/exportToPython.test.ts +++ b/src/test/datascience/export/exportToPython.test.ts @@ -3,6 +3,7 @@ // tslint:disable: no-var-requires no-require-imports no-invalid-this no-any import { assert } from 'chai'; +import { CancellationTokenSource } from 'monaco-editor'; import * as path from 'path'; import { Uri } from 'vscode'; import { IDocumentManager } from '../../../client/common/application/types'; @@ -33,9 +34,11 @@ suite('DataScience - Export Python', () => { const fileSystem = api.serviceContainer.get(IFileSystem); const exportToPython = api.serviceContainer.get(IExport, ExportFormat.python); const target = Uri.file((await fileSystem.createTemporaryFile('.py')).filePath); + const token = new CancellationTokenSource(); await exportToPython.export( Uri.file(path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'src', 'test', 'datascience', 'export', 'test.ipynb')), - target + target, + token.token ); const documentManager = api.serviceContainer.get(IDocumentManager); From 07a9e47f804622ad63234bde534ef3a4f5982664 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 9 Jul 2020 20:02:30 -0400 Subject: [PATCH 2/7] some small fixes --- src/client/datascience/export/exportBase.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/client/datascience/export/exportBase.ts b/src/client/datascience/export/exportBase.ts index 11b47a577a2e..6a8282b9ff9d 100644 --- a/src/client/datascience/export/exportBase.ts +++ b/src/client/datascience/export/exportBase.ts @@ -37,7 +37,9 @@ export class ExportBase implements IExport { const oldFileExists = await this.fileSystem.fileExists(target.fsPath); let oldFileTime; + let oldFileContents; if (oldFileExists) { + oldFileContents = await this.fileSystem.readFile(target.fsPath); oldFileTime = (await this.fileSystem.stat(target.fsPath)).mtime; } @@ -54,8 +56,12 @@ export class ExportBase implements IExport { if (token.isCancellationRequested) { if (oldFileExists) { const newFileTime = (await this.fileSystem.stat(target.fsPath)).mtime; - if (newFileTime === oldFileTime) { + if (newFileTime !== oldFileTime) { + // need to restore old file if it existed await this.fileSystem.deleteFile(target.fsPath); + if (oldFileContents) { + await this.fileSystem.writeFile(target.fsPath, oldFileContents); + } } } else { try { From a2d70d7ce1e42d4bf0eff993908e5812637bfd40 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 10 Jul 2020 11:38:41 -0400 Subject: [PATCH 3/7] removed monaco editor import --- src/test/datascience/export/exportToHTML.test.ts | 3 +-- src/test/datascience/export/exportToPython.test.ts | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/test/datascience/export/exportToHTML.test.ts b/src/test/datascience/export/exportToHTML.test.ts index 1fcfeeab9773..4412881dea0e 100644 --- a/src/test/datascience/export/exportToHTML.test.ts +++ b/src/test/datascience/export/exportToHTML.test.ts @@ -3,9 +3,8 @@ // tslint:disable: no-var-requires no-require-imports no-invalid-this no-any import { assert } from 'chai'; -import { CancellationTokenSource } from 'monaco-editor'; import * as path from 'path'; -import { Uri } from 'vscode'; +import { CancellationTokenSource, Uri } from 'vscode'; import { IFileSystem } from '../../../client/common/platform/types'; import { ExportFormat, IExport } from '../../../client/datascience/export/types'; import { IExtensionTestApi } from '../../common'; diff --git a/src/test/datascience/export/exportToPython.test.ts b/src/test/datascience/export/exportToPython.test.ts index d0ec953d78eb..d7d130f141e5 100644 --- a/src/test/datascience/export/exportToPython.test.ts +++ b/src/test/datascience/export/exportToPython.test.ts @@ -3,9 +3,8 @@ // tslint:disable: no-var-requires no-require-imports no-invalid-this no-any import { assert } from 'chai'; -import { CancellationTokenSource } from 'monaco-editor'; import * as path from 'path'; -import { Uri } from 'vscode'; +import { CancellationTokenSource, Uri } from 'vscode'; import { IDocumentManager } from '../../../client/common/application/types'; import { IFileSystem } from '../../../client/common/platform/types'; import { ExportFormat, IExport } from '../../../client/datascience/export/types'; From 89c1b75197c33e580cebd93c795994182489e8ab Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 10 Jul 2020 12:05:16 -0400 Subject: [PATCH 4/7] changed deleting method --- src/client/datascience/export/exportBase.ts | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/client/datascience/export/exportBase.ts b/src/client/datascience/export/exportBase.ts index 6a8282b9ff9d..971ceef38032 100644 --- a/src/client/datascience/export/exportBase.ts +++ b/src/client/datascience/export/exportBase.ts @@ -37,9 +37,7 @@ export class ExportBase implements IExport { const oldFileExists = await this.fileSystem.fileExists(target.fsPath); let oldFileTime; - let oldFileContents; if (oldFileExists) { - oldFileContents = await this.fileSystem.readFile(target.fsPath); oldFileTime = (await this.fileSystem.stat(target.fsPath)).mtime; } @@ -54,21 +52,10 @@ export class ExportBase implements IExport { }); if (token.isCancellationRequested) { - if (oldFileExists) { - const newFileTime = (await this.fileSystem.stat(target.fsPath)).mtime; - if (newFileTime !== oldFileTime) { - // need to restore old file if it existed - await this.fileSystem.deleteFile(target.fsPath); - if (oldFileContents) { - await this.fileSystem.writeFile(target.fsPath, oldFileContents); - } - } - } else { - try { - await this.fileSystem.deleteFile(target.fsPath); - // tslint:disable-next-line: no-empty - } catch {} - } + try { + await this.fileSystem.deleteFile(target.fsPath); + // tslint:disable-next-line: no-empty + } catch {} return; } From b8e298d0fdd992de2cb42ec63f720407498c5781 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 10 Jul 2020 14:46:33 -0400 Subject: [PATCH 5/7] made export to temp file first --- src/client/common/utils/localize.ts | 3 +- src/client/datascience/export/exportBase.ts | 50 +++++++++---------- src/client/datascience/export/exportToHTML.ts | 13 +---- src/client/datascience/export/exportToPDF.ts | 28 ++--------- src/client/datascience/export/types.ts | 5 ++ src/client/datascience/progress/messages.ts | 3 +- src/client/datascience/progress/types.ts | 3 +- 7 files changed, 40 insertions(+), 65 deletions(-) diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index 0f7629b79ed6..2a7bed155c7e 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -331,8 +331,9 @@ export namespace DataScience { 'DataScience.installingMissingDependencies', 'Installing missing dependencies' ); - export const performingExport = localize('DataScience.performingExport', 'Performing export'); + export const performingExport = localize('DataScience.performingExport', 'Performing Export'); export const convertingToPDF = localize('DataScience.convertingToPDF', 'Converting to PDF'); + export const copyingFile = localize('DataScience.copyingFile', 'Copying File'); export const exportNotebookToPython = localize( 'DataScience.exportNotebookToPython', 'Exporting Notebook to Python' diff --git a/src/client/datascience/export/exportBase.ts b/src/client/datascience/export/exportBase.ts index 971ceef38032..2614433f68e6 100644 --- a/src/client/datascience/export/exportBase.ts +++ b/src/client/datascience/export/exportBase.ts @@ -1,11 +1,12 @@ import { inject, injectable } from 'inversify'; +import * as path from 'path'; import { CancellationToken, Uri } from 'vscode'; import { IFileSystem } from '../../common/platform/types'; import { IPythonExecutionFactory, IPythonExecutionService } from '../../common/process/types'; import { reportAction } from '../progress/decorator'; import { ReportableAction } from '../progress/types'; import { IJupyterSubCommandExecutionService, INotebookImporter } from '../types'; -import { IExport } from './types'; +import { ExportFormat, IExport } from './types'; @injectable() export class ExportBase implements IExport { @@ -21,7 +22,12 @@ export class ExportBase implements IExport { public async export(_source: Uri, _target: Uri, _token: CancellationToken): Promise {} @reportAction(ReportableAction.PerformingExport) - public async executeCommand(source: Uri, target: Uri, args: string[], token: CancellationToken): Promise { + public async executeCommand( + source: Uri, + target: Uri, + format: ExportFormat, + token: CancellationToken + ): Promise { if (token.isCancellationRequested) { return; } @@ -35,16 +41,16 @@ export class ExportBase implements IExport { return; } - const oldFileExists = await this.fileSystem.fileExists(target.fsPath); - let oldFileTime; - if (oldFileExists) { - oldFileTime = (await this.fileSystem.stat(target.fsPath)).mtime; - } - - if (token.isCancellationRequested) { - return; - } - + const tempTarget = await this.fileSystem.createTemporaryFile(path.extname(target.fsPath)); + const args = [ + source.fsPath, + '--to', + format, + '--output', + path.basename(tempTarget.filePath), + '--output-dir', + path.dirname(tempTarget.filePath) + ]; const result = await service.execModule('jupyter', ['nbconvert'].concat(args), { throwOnStdErr: false, encoding: 'utf8', @@ -52,24 +58,16 @@ export class ExportBase implements IExport { }); if (token.isCancellationRequested) { - try { - await this.fileSystem.deleteFile(target.fsPath); - // tslint:disable-next-line: no-empty - } catch {} + tempTarget.dispose(); return; } - // Need to check if export failed, since throwOnStdErr is not an - // indicator of a failed export. - if (!(await this.fileSystem.fileExists(target.fsPath))) { + try { + await this.fileSystem.copyFile(tempTarget.filePath, target.fsPath); + } catch { throw new Error(result.stderr); - } else if (oldFileExists) { - // If we exported to a file that already exists we need to check that - // this file was actually overridden during export - const newFileTime = (await this.fileSystem.stat(target.fsPath)).mtime; - if (newFileTime === oldFileTime) { - throw new Error(result.stderr); - } + } finally { + tempTarget.dispose(); } } diff --git a/src/client/datascience/export/exportToHTML.ts b/src/client/datascience/export/exportToHTML.ts index dbdab0120494..d12c92502402 100644 --- a/src/client/datascience/export/exportToHTML.ts +++ b/src/client/datascience/export/exportToHTML.ts @@ -1,20 +1,11 @@ import { injectable } from 'inversify'; -import * as path from 'path'; import { CancellationToken, Uri } from 'vscode'; import { ExportBase } from './exportBase'; +import { ExportFormat } from './types'; @injectable() export class ExportToHTML extends ExportBase { public async export(source: Uri, target: Uri, token: CancellationToken): Promise { - const args = [ - source.fsPath, - '--to', - 'html', - '--output', - path.basename(target.fsPath), - '--output-dir', - path.dirname(target.fsPath) - ]; - await this.executeCommand(source, target, args, token); + await this.executeCommand(source, target, ExportFormat.html, token); } } diff --git a/src/client/datascience/export/exportToPDF.ts b/src/client/datascience/export/exportToPDF.ts index 7257a218387e..0b4b6afba335 100644 --- a/src/client/datascience/export/exportToPDF.ts +++ b/src/client/datascience/export/exportToPDF.ts @@ -1,33 +1,11 @@ -import { inject, injectable } from 'inversify'; -import * as path from 'path'; +import { injectable } from 'inversify'; import { CancellationToken, Uri } from 'vscode'; -import { IFileSystem } from '../../common/platform/types'; -import { IPythonExecutionFactory } from '../../common/process/types'; -import { IJupyterSubCommandExecutionService, INotebookImporter } from '../types'; import { ExportBase } from './exportBase'; +import { ExportFormat } from './types'; @injectable() export class ExportToPDF extends ExportBase { - constructor( - @inject(IPythonExecutionFactory) protected readonly pythonExecutionFactory: IPythonExecutionFactory, - @inject(IJupyterSubCommandExecutionService) - protected jupyterService: IJupyterSubCommandExecutionService, - @inject(IFileSystem) protected readonly fileSystem: IFileSystem, - @inject(INotebookImporter) protected readonly importer: INotebookImporter - ) { - super(pythonExecutionFactory, jupyterService, fileSystem, importer); - } - public async export(source: Uri, target: Uri, token: CancellationToken): Promise { - const args = [ - source.fsPath, - '--to', - 'pdf', - '--output', - path.basename(target.fsPath), - '--output-dir', - path.dirname(target.fsPath) - ]; - await this.executeCommand(source, target, args, token); + await this.executeCommand(source, target, ExportFormat.pdf, token); } } diff --git a/src/client/datascience/export/types.ts b/src/client/datascience/export/types.ts index 07ff4eee7f61..47f9f03c04f2 100644 --- a/src/client/datascience/export/types.ts +++ b/src/client/datascience/export/types.ts @@ -21,3 +21,8 @@ export const IExportManagerFilePicker = Symbol('IExportManagerFilePicker'); export interface IExportManagerFilePicker { getExportFileLocation(format: ExportFormat, source: Uri, defaultFileName?: string): Promise; } + +export interface IExportArgs { + source: string; + method: string; +} diff --git a/src/client/datascience/progress/messages.ts b/src/client/datascience/progress/messages.ts index 89abfaecaf6f..b8b7922a4d87 100644 --- a/src/client/datascience/progress/messages.ts +++ b/src/client/datascience/progress/messages.ts @@ -19,7 +19,8 @@ const progressMessages = { [ReportableAction.InstallingMissingDependencies]: DataScience.installingMissingDependencies(), [ReportableAction.ExportNotebookToPython]: DataScience.exportNotebookToPython(), [ReportableAction.PerformingExport]: DataScience.performingExport(), - [ReportableAction.ConvertingToPDF]: DataScience.convertingToPDF() + [ReportableAction.ConvertingToPDF]: DataScience.convertingToPDF(), + [ReportableAction.CopyingFile]: DataScience.copyingFile() }; /** diff --git a/src/client/datascience/progress/types.ts b/src/client/datascience/progress/types.ts index 12f51a14f121..50c8f9e52ba5 100644 --- a/src/client/datascience/progress/types.ts +++ b/src/client/datascience/progress/types.ts @@ -53,5 +53,6 @@ export enum ReportableAction { InstallingMissingDependencies = 'InstallingMissingDependencies', ExportNotebookToPython = 'ExportNotebookToPython', PerformingExport = 'PerformingExport', - ConvertingToPDF = 'ConvertingToPDF' + ConvertingToPDF = 'ConvertingToPDF', + CopyingFile = 'CopyingFile' } From 5795b9ff245bf86fc13e294b1d108315161842b3 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 10 Jul 2020 14:50:20 -0400 Subject: [PATCH 6/7] removed unused action --- package.nls.json | 2 +- src/client/common/utils/localize.ts | 1 - src/client/datascience/export/types.ts | 5 ----- src/client/datascience/progress/messages.ts | 3 +-- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/package.nls.json b/package.nls.json index b8941cffecd4..42737e8a84d1 100644 --- a/package.nls.json +++ b/package.nls.json @@ -23,7 +23,7 @@ "DataScience.checkingIfImportIsSupported": "Checking if import is supported", "DataScience.installingMissingDependencies": "Installing missing dependencies", "DataScience.exportNotebookToPython": "Exporting Notebook to Python", - "DataScience.performingExport": "Performing export", + "DataScience.performingExport": "Performing Export", "DataScience.convertingToPDF": "Converting to PDF", "DataScience.exportHTMLQuickPickLabel": "HTML", "DataScience.exportPDFQuickPickLabel": "PDF", diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index 2a7bed155c7e..c6ce5bb19a1f 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -333,7 +333,6 @@ export namespace DataScience { ); export const performingExport = localize('DataScience.performingExport', 'Performing Export'); export const convertingToPDF = localize('DataScience.convertingToPDF', 'Converting to PDF'); - export const copyingFile = localize('DataScience.copyingFile', 'Copying File'); export const exportNotebookToPython = localize( 'DataScience.exportNotebookToPython', 'Exporting Notebook to Python' diff --git a/src/client/datascience/export/types.ts b/src/client/datascience/export/types.ts index 47f9f03c04f2..07ff4eee7f61 100644 --- a/src/client/datascience/export/types.ts +++ b/src/client/datascience/export/types.ts @@ -21,8 +21,3 @@ export const IExportManagerFilePicker = Symbol('IExportManagerFilePicker'); export interface IExportManagerFilePicker { getExportFileLocation(format: ExportFormat, source: Uri, defaultFileName?: string): Promise; } - -export interface IExportArgs { - source: string; - method: string; -} diff --git a/src/client/datascience/progress/messages.ts b/src/client/datascience/progress/messages.ts index b8b7922a4d87..89abfaecaf6f 100644 --- a/src/client/datascience/progress/messages.ts +++ b/src/client/datascience/progress/messages.ts @@ -19,8 +19,7 @@ const progressMessages = { [ReportableAction.InstallingMissingDependencies]: DataScience.installingMissingDependencies(), [ReportableAction.ExportNotebookToPython]: DataScience.exportNotebookToPython(), [ReportableAction.PerformingExport]: DataScience.performingExport(), - [ReportableAction.ConvertingToPDF]: DataScience.convertingToPDF(), - [ReportableAction.CopyingFile]: DataScience.copyingFile() + [ReportableAction.ConvertingToPDF]: DataScience.convertingToPDF() }; /** From 16569264f683af9ccc3c80ace3b7b6131fc6fd69 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 10 Jul 2020 14:52:23 -0400 Subject: [PATCH 7/7] removed unused types --- src/client/datascience/progress/types.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/client/datascience/progress/types.ts b/src/client/datascience/progress/types.ts index 50c8f9e52ba5..12f51a14f121 100644 --- a/src/client/datascience/progress/types.ts +++ b/src/client/datascience/progress/types.ts @@ -53,6 +53,5 @@ export enum ReportableAction { InstallingMissingDependencies = 'InstallingMissingDependencies', ExportNotebookToPython = 'ExportNotebookToPython', PerformingExport = 'PerformingExport', - ConvertingToPDF = 'ConvertingToPDF', - CopyingFile = 'CopyingFile' + ConvertingToPDF = 'ConvertingToPDF' }