diff --git a/.eslintrc.js b/.eslintrc.js index 77c037785cc..f65c4e392d5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -308,8 +308,8 @@ module.exports = { }, { target: './src/kernels/**/*.ts', - from: './src/notebooks/**/*.ts', - message: 'Importing modules from ./src/notebooks into ./src/kernels code is not allowed.' + from: './src/**[!platform,telemetry,kernels]**/**/*.ts', + message: 'Only modules from ./src/platform and ./src/telemetry can be imported into ./src/kernels.' }, { target: './src/telemetry/**/**[!types]**.ts', diff --git a/src/kernels/jupyter/import-export/helpers.node.ts b/src/kernels/jupyter/import-export/helpers.node.ts deleted file mode 100644 index 85bf63caa5b..00000000000 --- a/src/kernels/jupyter/import-export/helpers.node.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -'use strict'; diff --git a/src/kernels/jupyter/serviceRegistry.node.ts b/src/kernels/jupyter/serviceRegistry.node.ts index 66dcf9cf48a..54ffbecb837 100644 --- a/src/kernels/jupyter/serviceRegistry.node.ts +++ b/src/kernels/jupyter/serviceRegistry.node.ts @@ -6,8 +6,6 @@ import { IRemoteKernelFinder } from '../raw/types'; import { INotebookProvider } from '../types'; import { JupyterCommandLineSelectorCommand } from './commands/commandLineSelector'; import { CommandRegistry } from './commands/commandRegistry'; -import { JupyterExporter } from './import-export/jupyterExporter.node'; -import { JupyterImporter } from './import-export/jupyterImporter.node'; import { JupyterCommandFactory } from './interpreter/jupyterCommand.node'; import { JupyterInterpreterDependencyService } from './interpreter/jupyterInterpreterDependencyService.node'; import { JupyterInterpreterOldCacheStateStore } from './interpreter/jupyterInterpreterOldCacheStateStore.node'; @@ -36,7 +34,6 @@ import { NotebookProvider } from './launcher/notebookProvider'; import { NotebookServerProvider } from './launcher/notebookServerProvider'; import { NotebookStarter } from './launcher/notebookStarter.node'; import { ServerConnectionType } from './launcher/serverConnectionType'; -import { ServerPreload } from './launcher/serverPreload.node'; import { JupyterServerUriStorage } from './launcher/serverUriStorage'; import { LiveRemoteKernelConnectionUsageTracker } from './liveRemoteKernelConnectionTracker'; import { RemoteKernelFinder } from './remoteKernelFinder'; @@ -46,8 +43,6 @@ import { JupyterRequestCreator } from './session/jupyterRequestCreator.node'; import { JupyterSessionManagerFactory } from './session/jupyterSessionManagerFactory'; import { RequestAgentCreator } from './session/requestAgentCreator.node'; import { - INotebookExporter, - INotebookImporter, IJupyterNotebookProvider, IJupyterExecution, IJupyterPasswordConnect, @@ -71,8 +66,6 @@ import { IJupyterCommandFactory, IJupyterSubCommandExecutionService } from './ty export function registerTypes(serviceManager: IServiceManager, _isDevMode: boolean) { serviceManager.add(IJupyterCommandFactory, JupyterCommandFactory); - serviceManager.add(INotebookExporter, JupyterExporter); - serviceManager.add(INotebookImporter, JupyterImporter); serviceManager.add(INotebookServerFactory, HostJupyterServerFactory); serviceManager.addSingleton(IJupyterNotebookProvider, JupyterNotebookProvider); serviceManager.addSingleton(IRemoteKernelFinder, RemoteKernelFinder); @@ -135,7 +128,6 @@ export function registerTypes(serviceManager: IServiceManager, _isDevMode: boole serviceManager.addSingleton(IJupyterServerUriStorage, JupyterServerUriStorage); serviceManager.addSingleton(INotebookStarter, NotebookStarter); serviceManager.addSingleton(INotebookProvider, NotebookProvider); - serviceManager.addSingleton(IExtensionSingleActivationService, ServerPreload); serviceManager.addSingleton(IJupyterBackingFileCreator, BackingFileCreator); serviceManager.addSingleton(IExtensionSingleActivationService, CommandRegistry); serviceManager.addSingleton( diff --git a/src/test/datascience/notebook/exportFull.vscode.test.ts b/src/test/datascience/notebook/exportFull.vscode.test.ts index 2ad94203edb..d2ce40d4ca3 100644 --- a/src/test/datascience/notebook/exportFull.vscode.test.ts +++ b/src/test/datascience/notebook/exportFull.vscode.test.ts @@ -33,7 +33,7 @@ import { Product } from '../../../kernels/installer/types'; import { ProcessService } from '../../../platform/common/process/proc.node'; import { BufferDecoder } from '../../../platform/common/process/decoder.node'; import { INbConvertInterpreterDependencyChecker, INotebookImporter } from '../../../kernels/jupyter/types'; -import { JupyterImporter } from '../../../kernels/jupyter/import-export/jupyterImporter.node'; +import { JupyterImporter } from '../../../webviews/extension-side/import-export/jupyterImporter.node'; import { IInterpreterService } from '../../../platform/interpreter/contracts'; import { PythonEnvironment } from '../../../platform/api/extension'; import { CodeSnippets, Identifiers } from '../../../platform/common/constants'; diff --git a/src/kernels/jupyter/import-export/jupyterExporter.node.ts b/src/webviews/extension-side/import-export/jupyterExporter.node.ts similarity index 99% rename from src/kernels/jupyter/import-export/jupyterExporter.node.ts rename to src/webviews/extension-side/import-export/jupyterExporter.node.ts index 91616f234b9..1ad3e1c6a06 100644 --- a/src/kernels/jupyter/import-export/jupyterExporter.node.ts +++ b/src/webviews/extension-side/import-export/jupyterExporter.node.ts @@ -18,7 +18,7 @@ import { concatMultilineString, pruneCell } from '../../../platform/common/utils import { DataScience } from '../../../platform/common/utils/localize'; import { IDataScienceErrorHandler } from '../../../platform/errors/types'; import { defaultNotebookFormat } from '../../../platform/common/constants'; -import { INotebookExporter, IJupyterExecution } from '../types'; +import { INotebookExporter, IJupyterExecution } from '../../../kernels/jupyter/types'; import { openAndShowNotebook } from '../../../platform/common/utils/notebooks'; import { noop } from '../../../platform/common/utils/misc'; import { CodeSnippets } from '../../../platform/common/constants'; diff --git a/src/kernels/jupyter/import-export/jupyterImporter.node.ts b/src/webviews/extension-side/import-export/jupyterImporter.node.ts similarity index 98% rename from src/kernels/jupyter/import-export/jupyterImporter.node.ts rename to src/webviews/extension-side/import-export/jupyterImporter.node.ts index 6c59abd721c..0401b132816 100644 --- a/src/kernels/jupyter/import-export/jupyterImporter.node.ts +++ b/src/webviews/extension-side/import-export/jupyterImporter.node.ts @@ -16,7 +16,11 @@ import { IDisposableRegistry, IConfigurationService } from '../../../platform/co import { DataScience } from '../../../platform/common/utils/localize'; import { PythonEnvironment } from '../../../platform/pythonEnvironments/info'; import { noop } from '../../../platform/common/utils/misc'; -import { INotebookImporter, INbConvertInterpreterDependencyChecker, INbConvertExportToPythonService } from '../types'; +import { + INotebookImporter, + INbConvertInterpreterDependencyChecker, + INbConvertExportToPythonService +} from '../../../kernels/jupyter/types'; import { IFileSystemNode } from '../../../platform/common/platform/types.node'; @injectable() diff --git a/src/kernels/jupyter/launcher/serverPreload.node.ts b/src/webviews/extension-side/serverPreload/serverPreload.node.ts similarity index 96% rename from src/kernels/jupyter/launcher/serverPreload.node.ts rename to src/webviews/extension-side/serverPreload/serverPreload.node.ts index 99349c753ae..24d2b5e2a59 100644 --- a/src/kernels/jupyter/launcher/serverPreload.node.ts +++ b/src/webviews/extension-side/serverPreload/serverPreload.node.ts @@ -13,11 +13,11 @@ import { IMemento, WORKSPACE_MEMENTO } from '../../../platform/common/types'; -import { getKernelConnectionLanguage } from '../../helpers'; -import { IKernel, IKernelProvider, INotebookProvider } from '../../types'; +import { getKernelConnectionLanguage } from '../../../kernels/helpers'; +import { IKernel, IKernelProvider, INotebookProvider } from '../../../kernels/types'; import { IInteractiveWindowProvider, IInteractiveWindow } from '../../../interactive-window/types'; -import { DisplayOptions } from '../../displayOptions'; -import { IRawNotebookProvider } from '../../raw/types'; +import { DisplayOptions } from '../../../kernels/displayOptions'; +import { IRawNotebookProvider } from '../../../kernels/raw/types'; import { isJupyterNotebook } from '../../../platform/common/utils'; import { noop } from '../../../platform/common/utils/misc'; diff --git a/src/webviews/extension-side/serviceRegistry.node.ts b/src/webviews/extension-side/serviceRegistry.node.ts index 7b0a26fa234..16a9a4c33b2 100644 --- a/src/webviews/extension-side/serviceRegistry.node.ts +++ b/src/webviews/extension-side/serviceRegistry.node.ts @@ -13,8 +13,13 @@ import { WebviewViewProvider } from './webviewViews/webviewViewProvider'; import { JupyterVariableDataProvider } from './dataviewer/jupyterVariableDataProvider'; import { JupyterVariableDataProviderFactory } from './dataviewer/jupyterVariableDataProviderFactory'; import { IJupyterVariableDataProvider, IJupyterVariableDataProviderFactory } from './dataviewer/types'; +import { INotebookExporter, INotebookImporter } from '../../kernels/jupyter/types'; +import { JupyterExporter } from './import-export/jupyterExporter.node'; +import { JupyterImporter } from './import-export/jupyterImporter.node'; +import { ServerPreload } from './serverPreload/serverPreload.node'; export function registerTypes(serviceManager: IServiceManager, _isDevMode: boolean) { + serviceManager.addSingleton(IExtensionSingleActivationService, ServerPreload); serviceManager.add(IWebviewViewProvider, WebviewViewProvider); serviceManager.add(IWebviewPanelProvider, WebviewPanelProvider); serviceManager.addSingleton( @@ -27,4 +32,6 @@ export function registerTypes(serviceManager: IServiceManager, _isDevMode: boole IJupyterVariableDataProviderFactory, JupyterVariableDataProviderFactory ); + serviceManager.add(INotebookExporter, JupyterExporter); + serviceManager.add(INotebookImporter, JupyterImporter); }