diff --git a/TELEMETRY.md b/TELEMETRY.md index 711a8012e7c..153050cee4a 100644 --- a/TELEMETRY.md +++ b/TELEMETRY.md @@ -1566,8 +1566,8 @@ No properties for event [src/kernels/execution/kernelExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/execution/kernelExecution.ts) ```typescript - this.documentExecutions.set(document, newCellExecutionQueue); - return newCellExecutionQueue; + traceInfoIfCI(`Dispose KernelExecution`); + this.disposables.forEach((d) => d.dispose()); } @captureTelemetry(Telemetry.Interrupt) @captureTelemetry(Telemetry.InterruptJupyterTime) @@ -6031,13 +6031,13 @@ No properties for event [src/kernels/execution/kernelExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/execution/kernelExecution.ts) ```typescript - return newCellExecutionQueue; + this.disposables.forEach((d) => d.dispose()); } @captureTelemetry(Telemetry.Interrupt) @captureTelemetry(Telemetry.InterruptJupyterTime) private async interruptExecution( session: IKernelConnectionSession, - pendingCells: Promise + pendingExecutions: Promise ``` @@ -6092,7 +6092,7 @@ No properties for event ## Locations Used -[src/kernels/ipywidgets/baseIPyWidgetScriptManager.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/baseIPyWidgetScriptManager.ts) +[src/notebooks/controllers/ipywidgets/scriptSourceProvider/baseIPyWidgetScriptManager.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/scriptSourceProvider/baseIPyWidgetScriptManager.ts) ```typescript )}` ); @@ -6143,7 +6143,7 @@ No properties for event ## Locations Used -[src/kernels/ipywidgets/ipyWidgetScriptSource.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/ipyWidgetScriptSource.ts) +[src/notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptSource.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptSource.ts) ```typescript } } catch (ex) { @@ -6174,7 +6174,7 @@ No properties for event ## Locations Used -[src/kernels/ipywidgets/baseIPyWidgetScriptManager.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/baseIPyWidgetScriptManager.ts) +[src/notebooks/controllers/ipywidgets/scriptSourceProvider/baseIPyWidgetScriptManager.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/scriptSourceProvider/baseIPyWidgetScriptManager.ts) ```typescript } @@ -6186,7 +6186,7 @@ No properties for event ``` -[src/kernels/ipywidgets/baseIPyWidgetScriptManager.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/baseIPyWidgetScriptManager.ts) +[src/notebooks/controllers/ipywidgets/scriptSourceProvider/baseIPyWidgetScriptManager.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/scriptSourceProvider/baseIPyWidgetScriptManager.ts) ```typescript // Find the end bracket for the require config call. const endBracket = contents.indexOf(')', indexOfRequireConfig); @@ -6198,7 +6198,7 @@ No properties for event ``` -[src/kernels/ipywidgets/baseIPyWidgetScriptManager.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/baseIPyWidgetScriptManager.ts) +[src/notebooks/controllers/ipywidgets/scriptSourceProvider/baseIPyWidgetScriptManager.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/scriptSourceProvider/baseIPyWidgetScriptManager.ts) ```typescript }); @@ -6210,7 +6210,7 @@ No properties for event ``` -[src/kernels/ipywidgets/baseIPyWidgetScriptManager.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/baseIPyWidgetScriptManager.ts) +[src/notebooks/controllers/ipywidgets/scriptSourceProvider/baseIPyWidgetScriptManager.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/scriptSourceProvider/baseIPyWidgetScriptManager.ts) ```typescript }); return; @@ -6261,7 +6261,7 @@ No properties for event ## Locations Used -[src/kernels/ipywidgets/commonMessageCoordinator.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/commonMessageCoordinator.ts) +[src/notebooks/controllers/ipywidgets/message/commonMessageCoordinator.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/message/commonMessageCoordinator.ts) ```typescript } traceError(`Widget load failure ${errorMessage}`, payload); @@ -6291,7 +6291,7 @@ No properties for event ## Locations Used -[src/kernels/ipywidgets/commonMessageCoordinator.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/commonMessageCoordinator.ts) +[src/notebooks/controllers/ipywidgets/message/commonMessageCoordinator.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/message/commonMessageCoordinator.ts) ```typescript private sendLoadSucceededTelemetry(payload: LoadIPyWidgetClassLoadAction) { @@ -6321,7 +6321,7 @@ No properties for event ## Locations Used -[src/kernels/ipywidgets/ipyWidgetMessageDispatcher.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/ipyWidgetMessageDispatcher.ts) +[src/notebooks/controllers/ipywidgets/message/ipyWidgetMessageDispatcher.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/message/ipyWidgetMessageDispatcher.ts) ```typescript } @@ -6352,7 +6352,7 @@ No properties for event ## Locations Used -[src/kernels/ipywidgets/cdnWidgetScriptSourceProvider.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/cdnWidgetScriptSourceProvider.ts) +[src/notebooks/controllers/ipywidgets/scriptSourceProvider/cdnWidgetScriptSourceProvider.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/scriptSourceProvider/cdnWidgetScriptSourceProvider.ts) ```typescript return this.configurationPromise.promise; } @@ -6382,7 +6382,7 @@ No properties for event ## Locations Used -[src/kernels/ipywidgets/cdnWidgetScriptSourceProvider.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/cdnWidgetScriptSourceProvider.ts) +[src/notebooks/controllers/ipywidgets/scriptSourceProvider/cdnWidgetScriptSourceProvider.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/scriptSourceProvider/cdnWidgetScriptSourceProvider.ts) ```typescript break; } @@ -6412,7 +6412,7 @@ No properties for event ## Locations Used -[src/kernels/ipywidgets/commonMessageCoordinator.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/commonMessageCoordinator.ts) +[src/notebooks/controllers/ipywidgets/message/commonMessageCoordinator.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/message/commonMessageCoordinator.ts) ```typescript private sendRenderFailureTelemetry(payload: Error) { try { @@ -6463,7 +6463,7 @@ No properties for event ## Locations Used -[src/kernels/ipywidgets/localIPyWidgetScriptManager.node.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/localIPyWidgetScriptManager.node.ts) +[src/notebooks/controllers/ipywidgets/scriptSourceProvider/localIPyWidgetScriptManager.node.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/scriptSourceProvider/localIPyWidgetScriptManager.node.ts) ```typescript LocalIPyWidgetScriptManager.nbExtensionsCopiedKernelConnectionList.add( this.kernel.kernelConnectionMetadata.id @@ -6475,7 +6475,7 @@ No properties for event ``` -[src/kernels/ipywidgets/localIPyWidgetScriptManager.node.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/localIPyWidgetScriptManager.node.ts) +[src/notebooks/controllers/ipywidgets/scriptSourceProvider/localIPyWidgetScriptManager.node.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/scriptSourceProvider/localIPyWidgetScriptManager.node.ts) ```typescript sendTelemetryEvent(Telemetry.IPyWidgetNbExtensionCopyTime, stopWatch.elapsedTime); return baseUrl; @@ -6505,7 +6505,7 @@ No properties for event ## Locations Used -[src/kernels/ipywidgets/commonMessageCoordinator.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/commonMessageCoordinator.ts) +[src/notebooks/controllers/ipywidgets/message/commonMessageCoordinator.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/message/commonMessageCoordinator.ts) ```typescript this.jupyterOutput.appendLine( DataScience.unhandledMessage().format(msg.header.msg_type, JSON.stringify(msg.content)) @@ -6535,7 +6535,7 @@ No properties for event ## Locations Used -[src/kernels/ipywidgets/ipyWidgetScriptSourceProvider.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/ipyWidgetScriptSourceProvider.ts) +[src/notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptSourceProvider.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptSourceProvider.ts) ```typescript } } @@ -6565,7 +6565,7 @@ No properties for event ## Locations Used -[src/kernels/ipywidgets/commonMessageCoordinator.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/ipywidgets/commonMessageCoordinator.ts) +[src/notebooks/controllers/ipywidgets/message/commonMessageCoordinator.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/controllers/ipywidgets/message/commonMessageCoordinator.ts) ```typescript } private sendUnsupportedWidgetVersionFailureTelemetry(payload: NotifyIPyWidgetWidgetVersionNotSupportedAction) { @@ -7311,18 +7311,6 @@ No properties for event ## Locations Used -[src/kernels/kernel.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/kernel.ts) -```typescript - // Setup telemetry - if (!this.perceivedJupyterStartupTelemetryCaptured) { - this.perceivedJupyterStartupTelemetryCaptured = true; - sendTelemetryEvent(Telemetry.PerceivedJupyterStartupNotebook, stopWatch.elapsedTime); - executionPromise - .finally(() => - sendTelemetryEvent(Telemetry.StartExecuteNotebookCellPerceivedCold, stopWatch.elapsedTime) -``` - - [src/kernels/kernel.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/kernel.ts) ```typescript @@ -7334,6 +7322,18 @@ No properties for event this._session = session; ``` + +[src/kernels/kernel.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/kernel.ts) +```typescript + // Setup telemetry + if (!this.perceivedJupyterStartupTelemetryCaptured) { + this.perceivedJupyterStartupTelemetryCaptured = true; + sendTelemetryEvent(Telemetry.PerceivedJupyterStartupNotebook, stopWatch.elapsedTime); + executionPromise + .finally(() => + sendTelemetryEvent(Telemetry.StartExecuteNotebookCellPerceivedCold, stopWatch.elapsedTime) +``` +
DS_INTERNAL.PREFERRED_KERNEL diff --git a/src/extension.node.ts b/src/extension.node.ts index 4b73634849c..18ba8fa4eaa 100644 --- a/src/extension.node.ts +++ b/src/extension.node.ts @@ -320,7 +320,7 @@ async function activateLegacy( // Register the rest of the types (platform is first because it's needed by others) registerPlatformTypes(serviceManager); registerKernelTypes(serviceManager, isDevMode); - registerNotebookTypes(serviceManager); + registerNotebookTypes(serviceManager, isDevMode); registerInteractiveTypes(serviceManager); registerStandaloneTypes(context, serviceManager, isDevMode); registerWebviewTypes(serviceManager); diff --git a/src/extension.web.ts b/src/extension.web.ts index 5fb8f8c8981..d6abb1f7176 100644 --- a/src/extension.web.ts +++ b/src/extension.web.ts @@ -286,7 +286,7 @@ async function activateLegacy( // Register the rest of the types (platform is first because it's needed by others) registerPlatformTypes(serviceManager); - registerNotebookTypes(serviceManager); + registerNotebookTypes(serviceManager, isDevMode); registerKernelTypes(serviceManager, isDevMode); registerInteractiveTypes(serviceManager); registerTerminalTypes(serviceManager); diff --git a/src/kernels/execution/cellExecutionMessageHandler.ts b/src/kernels/execution/cellExecutionMessageHandler.ts index bd4d2d60ce0..f4b7e5b6b29 100644 --- a/src/kernels/execution/cellExecutionMessageHandler.ts +++ b/src/kernels/execution/cellExecutionMessageHandler.ts @@ -43,9 +43,8 @@ import { swallowExceptions } from '../../platform/common/utils/decorators'; import { noop } from '../../platform/common/utils/misc'; import { ITracebackFormatter } from '../../kernels/types'; import { handleTensorBoardDisplayDataOutput } from './executionHelpers'; -import { WIDGET_MIMETYPE } from '../ipywidgets/constants'; import isObject = require('lodash/isObject'); -import { Identifiers } from '../../platform/common/constants'; +import { Identifiers, WIDGET_MIMETYPE } from '../../platform/common/constants'; import { Lazy } from '../../platform/common/utils/lazy'; // Helper interface for the set_next_input execute reply payload diff --git a/src/kernels/ipywidgets/constants.ts b/src/kernels/ipywidgets/constants.ts deleted file mode 100644 index a413d7ec749..00000000000 --- a/src/kernels/ipywidgets/constants.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -export const WIDGET_MIMETYPE = 'application/vnd.jupyter.widget-view+json'; diff --git a/src/kernels/serviceRegistry.node.ts b/src/kernels/serviceRegistry.node.ts index 9e9a779707d..1edbbd40b20 100644 --- a/src/kernels/serviceRegistry.node.ts +++ b/src/kernels/serviceRegistry.node.ts @@ -36,7 +36,6 @@ import { import { IJupyterVariables, IKernelVariableRequester } from './variables/types'; import { KernelCrashMonitor } from './kernelCrashMonitor'; import { KernelAutoRestartMonitor } from './kernelAutoRestartMonitor.node'; -import { registerTypes as registerWidgetTypes } from './ipywidgets/serviceRegistry.node'; import { registerTypes as registerJupyterTypes } from './jupyter/serviceRegistry.node'; import { KernelProvider, ThirdPartyKernelProvider } from './kernelProvider.node'; import { KernelFinder } from './kernelFinder.node'; @@ -103,7 +102,6 @@ export function registerTypes(serviceManager: IServiceManager, isDevMode: boolea // Subdirectories registerJupyterTypes(serviceManager, isDevMode); registerInstallerTypes(serviceManager); - registerWidgetTypes(serviceManager, isDevMode); const isVSCInsiders = serviceManager.get(IApplicationEnvironment).channel === 'insiders'; const packageJson: { engines: { vscode: string } } | undefined = diff --git a/src/kernels/serviceRegistry.web.ts b/src/kernels/serviceRegistry.web.ts index a76db5e1c66..ecb1d6a40c4 100644 --- a/src/kernels/serviceRegistry.web.ts +++ b/src/kernels/serviceRegistry.web.ts @@ -11,7 +11,6 @@ import { IServiceManager } from '../platform/ioc/types'; import { setSharedProperty } from '../telemetry'; import { IRawNotebookSupportedService } from './raw/types'; import { KernelCrashMonitor } from './kernelCrashMonitor'; -import { registerTypes as registerWidgetTypes } from './ipywidgets/serviceRegistry.web'; import { registerTypes as registerJupyterTypes } from './jupyter/serviceRegistry.web'; import { injectable } from 'inversify'; import { IKernelFinder, IKernelProvider, IThirdPartyKernelProvider } from './types'; @@ -70,7 +69,6 @@ export function registerTypes(serviceManager: IServiceManager, isDevMode: boolea serviceManager.addSingleton(IKernelFinder, KernelFinder); // Subdirectories - registerWidgetTypes(serviceManager, isDevMode); registerJupyterTypes(serviceManager, isDevMode); serviceManager.addSingleton(CellOutputDisplayIdTracker, CellOutputDisplayIdTracker); diff --git a/src/kernels/types.ts b/src/kernels/types.ts index 186d4cbbd6f..279611911f7 100644 --- a/src/kernels/types.ts +++ b/src/kernels/types.ts @@ -13,7 +13,6 @@ import type { NotebookCell, NotebookController, NotebookDocument, - QuickPickItem, Uri } from 'vscode'; import type * as nbformat from '@jupyterlab/nbformat'; @@ -111,11 +110,6 @@ export type RemoteKernelConnectionMetadata = | Readonly | Readonly; -export interface IKernelSpecQuickPickItem - extends QuickPickItem { - selection: T; -} - export function isLocalConnection( kernelConnection: KernelConnectionMetadata ): kernelConnection is LocalKernelConnectionMetadata { @@ -130,33 +124,6 @@ export function isRemoteConnection( return !isLocalConnection(kernelConnection); } -export interface IKernel extends IBaseKernel { - /** - * Total execution count on this kernel - */ - readonly executionCount: number; - readonly notebook: NotebookDocument; - readonly onPreExecute: Event; - /** - * Cells that are still being executed (or pending). - */ - readonly pendingCells: readonly NotebookCell[]; - /** - * Controller associated with this kernel - */ - readonly controller: NotebookController; - readonly creator: 'jupyterExtension'; - /** - * @param cell Cell to execute - * @param codeOverride Override the code to execute - */ - executeCell(cell: NotebookCell, codeOverride?: string): Promise; - /** - * Executes arbitrary code against the kernel without incrementing the execution count. - */ - executeHidden(code: string): Promise; -} - export interface IBaseKernel extends IAsyncDisposable { readonly uri: Uri; /** @@ -206,27 +173,84 @@ export interface IBaseKernel extends IAsyncDisposable { addEventHook(hook: (event: 'willRestart' | 'willInterrupt') => Promise): void; removeEventHook(hook: (event: 'willRestart' | 'willInterrupt') => Promise): void; } + +/** + * Kernels created by this extension. + */ +export interface IKernel extends IBaseKernel { + /** + * Total execution count on this kernel + */ + readonly executionCount: number; + readonly notebook: NotebookDocument; + readonly onPreExecute: Event; + /** + * Cells that are still being executed (or pending). + */ + readonly pendingCells: readonly NotebookCell[]; + /** + * Controller associated with this kernel + */ + readonly controller: NotebookController; + readonly creator: 'jupyterExtension'; + /** + * @param cell Cell to execute + * @param codeOverride Override the code to execute + */ + executeCell(cell: NotebookCell, codeOverride?: string): Promise; + /** + * Executes arbitrary code against the kernel without incrementing the execution count. + */ + executeHidden(code: string): Promise; +} + +/** + * Kernels created by third party extensions. + */ export interface IThirdPartyKernel extends IBaseKernel { readonly creator: '3rdPartyExtension'; } -export type ThirdPartyKernelOptions = { +/** + * Kernel options for creating first party kernels. + */ +export type KernelOptions = { metadata: KernelConnectionMetadata; + controller: NotebookController; /** * When creating a kernel for an Interactive window, pass the Uri of the Python file here (to set the working directory, file & the like) * In the case of Notebooks, just pass the uri of the notebook. */ resourceUri: Resource; }; -export type KernelOptions = { + +/** + * Kernel options for creating third party kernels. + */ +export type ThirdPartyKernelOptions = { metadata: KernelConnectionMetadata; - controller: NotebookController; /** * When creating a kernel for an Interactive window, pass the Uri of the Python file here (to set the working directory, file & the like) * In the case of Notebooks, just pass the uri of the notebook. */ resourceUri: Resource; }; + +/** + * Common kernel provider interface shared between first party and third party kernel providers. + */ +export interface IBaseKernelProvider extends IAsyncDisposable { + readonly kernels: Readonly; + onDidCreateKernel: Event; + onDidStartKernel: Event; + onDidRestartKernel: Event; + onDidDisposeKernel: Event; + onKernelStatusChanged: Event<{ status: KernelMessage.Status; kernel: T }>; +} + +/** + * Kernel provider for fetching and creating kernels inside the extension. + */ export const IKernelProvider = Symbol('IKernelProvider'); export interface IKernelProvider extends IBaseKernelProvider { /** @@ -240,6 +264,9 @@ export interface IKernelProvider extends IBaseKernelProvider { getOrCreate(notebook: NotebookDocument, options: KernelOptions): IKernel; } +/** + * Kernel provider used by third party extensions (indirectly). + */ export const IThirdPartyKernelProvider = Symbol('IThirdPartyKernelProvider'); export interface IThirdPartyKernelProvider extends IBaseKernelProvider { /** @@ -253,15 +280,6 @@ export interface IThirdPartyKernelProvider extends IBaseKernelProvider extends IAsyncDisposable { - readonly kernels: Readonly; - onDidCreateKernel: Event; - onDidStartKernel: Event; - onDidRestartKernel: Event; - onDidDisposeKernel: Event; - onKernelStatusChanged: Event<{ status: KernelMessage.Status; kernel: T }>; -} - export interface IRawConnection { readonly type: 'raw'; readonly localLaunch: true; @@ -625,6 +643,9 @@ export const enum StartupCodePriority { Debugging = 5 } +/** + * Startup code provider provides code snippets that are run right after the kernel is started but before running any code. + */ export const IStartupCodeProvider = Symbol('IStartupCodeProvider'); export interface IStartupCodeProvider { priority: StartupCodePriority; diff --git a/src/messageTypes.ts b/src/messageTypes.ts index 68146e5c750..79e9a7813c1 100644 --- a/src/messageTypes.ts +++ b/src/messageTypes.ts @@ -11,10 +11,10 @@ import { } from './webviews/webview-side/interactive-common/redux/reducers/types'; // eslint-disable-next-line import { BaseReduxActionPayload } from './webviews/types'; -import { WidgetScriptSource } from './kernels/ipywidgets/types'; import { KernelConnectionMetadata, KernelSocketOptions } from './kernels/types'; import { ICell } from './platform/common/types'; import { IJupyterVariable, IJupyterVariablesRequest, IJupyterVariablesResponse } from './kernels/variables/types'; +import { WidgetScriptSource } from './notebooks/controllers/ipywidgets/types'; export type NotifyIPyWidgetWidgetVersionNotSupportedAction = { moduleName: 'qgrid'; diff --git a/src/kernels/ipywidgets/commonMessageCoordinator.ts b/src/notebooks/controllers/ipywidgets/message/commonMessageCoordinator.ts similarity index 91% rename from src/kernels/ipywidgets/commonMessageCoordinator.ts rename to src/notebooks/controllers/ipywidgets/message/commonMessageCoordinator.ts index 17f1382c209..a33ee4eabde 100644 --- a/src/kernels/ipywidgets/commonMessageCoordinator.ts +++ b/src/notebooks/controllers/ipywidgets/message/commonMessageCoordinator.ts @@ -5,38 +5,38 @@ import type { KernelMessage } from '@jupyterlab/services'; import { Event, EventEmitter, NotebookDocument } from 'vscode'; -import { IApplicationShell, ICommandManager } from '../../platform/common/application/types'; -import { STANDARD_OUTPUT_CHANNEL } from '../../platform/common/constants'; -import { traceVerbose, traceError, traceInfo, traceInfoIfCI } from '../../platform/logging'; +import { IApplicationShell, ICommandManager } from '../../../../platform/common/application/types'; +import { STANDARD_OUTPUT_CHANNEL } from '../../../../platform/common/constants'; +import { traceVerbose, traceError, traceInfo, traceInfoIfCI } from '../../../../platform/logging'; import { IDisposableRegistry, IOutputChannel, IConfigurationService, IHttpClient, IsWebExtension -} from '../../platform/common/types'; -import { Common, DataScience } from '../../platform/common/utils/localize'; -import { noop } from '../../platform/common/utils/misc'; -import { stripAnsi } from '../../platform/common/utils/regexp'; +} from '../../../../platform/common/types'; +import { Common, DataScience } from '../../../../platform/common/utils/localize'; +import { noop } from '../../../../platform/common/utils/misc'; +import { stripAnsi } from '../../../../platform/common/utils/regexp'; import { ILoadIPyWidgetClassFailureAction, InteractiveWindowMessages, IPyWidgetMessages, LoadIPyWidgetClassLoadAction, NotifyIPyWidgetWidgetVersionNotSupportedAction -} from '../../messageTypes'; -import { IServiceContainer } from '../../platform/ioc/types'; -import { sendTelemetryEvent, Telemetry } from '../../telemetry'; -import { getTelemetrySafeHashedString } from '../../platform/telemetry/helpers'; -import { Commands } from '../../platform/common/constants'; -import { IKernelProvider } from '../types'; +} from '../../../../messageTypes'; +import { IServiceContainer } from '../../../../platform/ioc/types'; +import { sendTelemetryEvent, Telemetry } from '../../../../telemetry'; +import { getTelemetrySafeHashedString } from '../../../../platform/telemetry/helpers'; +import { Commands } from '../../../../platform/common/constants'; +import { IKernelProvider } from '../../../../kernels/types'; import { IPyWidgetMessageDispatcherFactory } from './ipyWidgetMessageDispatcherFactory'; -import { IPyWidgetScriptSource } from './ipyWidgetScriptSource'; -import { IIPyWidgetMessageDispatcher, IWidgetScriptSourceProviderFactory } from './types'; -import { ConsoleForegroundColors } from '../../platform/logging/types'; -import { createDeferred } from '../../platform/common/utils/async'; -import { IWebviewCommunication } from '../../platform/webviews/types'; -import { swallowExceptions } from '../../platform/common/utils/decorators'; +import { IPyWidgetScriptSource } from '../scriptSourceProvider/ipyWidgetScriptSource'; +import { IIPyWidgetMessageDispatcher, IWidgetScriptSourceProviderFactory } from '../types'; +import { ConsoleForegroundColors } from '../../../../platform/logging/types'; +import { createDeferred } from '../../../../platform/common/utils/async'; +import { IWebviewCommunication } from '../../../../platform/webviews/types'; +import { swallowExceptions } from '../../../../platform/common/utils/decorators'; /** * This class wraps all of the ipywidgets communication with a backing notebook diff --git a/src/kernels/ipywidgets/ipyWidgetMessageDispatcher.ts b/src/notebooks/controllers/ipywidgets/message/ipyWidgetMessageDispatcher.ts similarity index 97% rename from src/kernels/ipywidgets/ipyWidgetMessageDispatcher.ts rename to src/notebooks/controllers/ipywidgets/message/ipyWidgetMessageDispatcher.ts index 53de6a1f8cc..3e755f54416 100644 --- a/src/kernels/ipywidgets/ipyWidgetMessageDispatcher.ts +++ b/src/notebooks/controllers/ipywidgets/message/ipyWidgetMessageDispatcher.ts @@ -7,17 +7,16 @@ import type { KernelMessage } from '@jupyterlab/services'; import * as uuid from 'uuid/v4'; import { Event, EventEmitter, NotebookDocument } from 'vscode'; import type { Data as WebSocketData } from 'ws'; -import { traceVerbose, traceError, traceInfo } from '../../platform/logging'; -import { Identifiers } from '../../platform/common/constants'; -import { IDisposable } from '../../platform/common/types'; -import { Deferred, createDeferred } from '../../platform/common/utils/async'; -import { noop } from '../../platform/common/utils/misc'; -import { deserializeDataViews, serializeDataViews } from '../../platform/common/utils/serializers'; -import { IPyWidgetMessages, IInteractiveWindowMapping } from '../../messageTypes'; -import { sendTelemetryEvent, Telemetry } from '../../telemetry'; -import { IKernel, IKernelProvider, KernelSocketInformation } from '../types'; -import { WIDGET_MIMETYPE } from './constants'; -import { IIPyWidgetMessageDispatcher, IPyWidgetMessage } from './types'; +import { traceVerbose, traceError, traceInfo } from '../../../../platform/logging'; +import { Identifiers, WIDGET_MIMETYPE } from '../../../../platform/common/constants'; +import { IDisposable } from '../../../../platform/common/types'; +import { Deferred, createDeferred } from '../../../../platform/common/utils/async'; +import { noop } from '../../../../platform/common/utils/misc'; +import { deserializeDataViews, serializeDataViews } from '../../../../platform/common/utils/serializers'; +import { IPyWidgetMessages, IInteractiveWindowMapping } from '../../../../messageTypes'; +import { sendTelemetryEvent, Telemetry } from '../../../../telemetry'; +import { IKernel, IKernelProvider, KernelSocketInformation } from '../../../../kernels/types'; +import { IIPyWidgetMessageDispatcher, IPyWidgetMessage } from '../types'; type PendingMessage = { resultPromise: Deferred; diff --git a/src/kernels/ipywidgets/ipyWidgetMessageDispatcherFactory.ts b/src/notebooks/controllers/ipywidgets/message/ipyWidgetMessageDispatcherFactory.ts similarity index 96% rename from src/kernels/ipywidgets/ipyWidgetMessageDispatcherFactory.ts rename to src/notebooks/controllers/ipywidgets/message/ipyWidgetMessageDispatcherFactory.ts index cf84b57556e..35921122c00 100644 --- a/src/kernels/ipywidgets/ipyWidgetMessageDispatcherFactory.ts +++ b/src/notebooks/controllers/ipywidgets/message/ipyWidgetMessageDispatcherFactory.ts @@ -5,11 +5,11 @@ import { inject, injectable } from 'inversify'; import { Event, EventEmitter, NotebookDocument } from 'vscode'; -import { IDisposable, IDisposableRegistry } from '../../platform/common/types'; -import { IPyWidgetMessages } from '../../messageTypes'; -import { IKernel, IKernelProvider } from '../types'; +import { IDisposable, IDisposableRegistry } from '../../../../platform/common/types'; +import { IPyWidgetMessages } from '../../../../messageTypes'; +import { IKernel, IKernelProvider } from '../../../../kernels/types'; import { IPyWidgetMessageDispatcher } from './ipyWidgetMessageDispatcher'; -import { IIPyWidgetMessageDispatcher, IPyWidgetMessage } from './types'; +import { IIPyWidgetMessageDispatcher, IPyWidgetMessage } from '../types'; /** * This just wraps the iPyWidgetMessageDispatcher class. diff --git a/src/kernels/ipywidgets/baseIPyWidgetScriptManager.ts b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/baseIPyWidgetScriptManager.ts similarity index 91% rename from src/kernels/ipywidgets/baseIPyWidgetScriptManager.ts rename to src/notebooks/controllers/ipywidgets/scriptSourceProvider/baseIPyWidgetScriptManager.ts index 6a79d89ef5e..b0f9100eb64 100644 --- a/src/kernels/ipywidgets/baseIPyWidgetScriptManager.ts +++ b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/baseIPyWidgetScriptManager.ts @@ -3,17 +3,17 @@ // Licensed under the MIT License. import { Uri } from 'vscode'; -import { disposeAllDisposables } from '../../platform/common/helpers'; -import { getDisplayPath } from '../../platform/common/platform/fs-paths'; -import { IDisposable } from '../../platform/common/types'; -import { traceError, traceInfoIfCI, traceWarning } from '../../platform/logging'; -import { sendTelemetryEvent, Telemetry } from '../../telemetry'; -import { IKernel, isLocalConnection } from '../types'; -import { getTelemetrySafeHashedString } from '../../platform/telemetry/helpers'; +import { disposeAllDisposables } from '../../../../platform/common/helpers'; +import { getDisplayPath } from '../../../../platform/common/platform/fs-paths'; +import { IDisposable } from '../../../../platform/common/types'; +import { traceError, traceInfoIfCI, traceWarning } from '../../../../platform/logging'; +import { sendTelemetryEvent, Telemetry } from '../../../../telemetry'; +import { IKernel, isLocalConnection } from '../../../../kernels/types'; +import { getTelemetrySafeHashedString } from '../../../../platform/telemetry/helpers'; import * as stripComments from 'strip-comments'; -import { IIPyWidgetScriptManager } from './types'; -import { StopWatch } from '../../platform/common/utils/stopWatch'; -import { isCI } from '../../platform/common/constants'; +import { IIPyWidgetScriptManager } from '../types'; +import { StopWatch } from '../../../../platform/common/utils/stopWatch'; +import { isCI } from '../../../../platform/common/constants'; export function extractRequireConfigFromWidgetEntry(baseUrl: Uri, widgetFolderName: string, contents: string) { // Look for `require.config(` or `window["require"].config` or `window['requirejs'].config` diff --git a/src/kernels/ipywidgets/cdnWidgetScriptSourceProvider.ts b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/cdnWidgetScriptSourceProvider.ts similarity index 94% rename from src/kernels/ipywidgets/cdnWidgetScriptSourceProvider.ts rename to src/notebooks/controllers/ipywidgets/scriptSourceProvider/cdnWidgetScriptSourceProvider.ts index d85c0247971..e227ef407e8 100644 --- a/src/kernels/ipywidgets/cdnWidgetScriptSourceProvider.ts +++ b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/cdnWidgetScriptSourceProvider.ts @@ -4,16 +4,16 @@ 'use strict'; import { ConfigurationTarget, Memento } from 'vscode'; -import { IApplicationShell } from '../../platform/common/application/types'; -import { Telemetry } from '../../platform/common/constants'; -import { IConfigurationService, IHttpClient, WidgetCDNs } from '../../platform/common/types'; -import { createDeferred, Deferred } from '../../platform/common/utils/async'; -import { Common, DataScience } from '../../platform/common/utils/localize'; -import { noop } from '../../platform/common/utils/misc'; -import { traceError, traceInfo, traceVerbose } from '../../platform/logging'; -import { ConsoleForegroundColors } from '../../platform/logging/types'; -import { sendTelemetryEvent } from '../../telemetry'; -import { IWidgetScriptSourceProvider, WidgetScriptSource } from './types'; +import { IApplicationShell } from '../../../../platform/common/application/types'; +import { Telemetry } from '../../../../platform/common/constants'; +import { IConfigurationService, IHttpClient, WidgetCDNs } from '../../../../platform/common/types'; +import { createDeferred, Deferred } from '../../../../platform/common/utils/async'; +import { Common, DataScience } from '../../../../platform/common/utils/localize'; +import { noop } from '../../../../platform/common/utils/misc'; +import { traceError, traceInfo, traceVerbose } from '../../../../platform/logging'; +import { ConsoleForegroundColors } from '../../../../platform/logging/types'; +import { sendTelemetryEvent } from '../../../../telemetry'; +import { IWidgetScriptSourceProvider, WidgetScriptSource } from '../types'; // Source borrowed from https://github.com/jupyter-widgets/ipywidgets/blob/54941b7a4b54036d089652d91b39f937bde6b6cd/packages/html-manager/src/libembed-amd.ts#L33 const unpgkUrl = 'https://unpkg.com/'; diff --git a/src/kernels/ipywidgets/ipyWidgetScriptManagerFactory.node.ts b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptManagerFactory.node.ts similarity index 85% rename from src/kernels/ipywidgets/ipyWidgetScriptManagerFactory.node.ts rename to src/notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptManagerFactory.node.ts index 629c3c35da7..6b915ff6ca8 100644 --- a/src/kernels/ipywidgets/ipyWidgetScriptManagerFactory.node.ts +++ b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptManagerFactory.node.ts @@ -3,13 +3,13 @@ // Licensed under the MIT License. import { injectable, inject } from 'inversify'; -import { IFileSystemNode } from '../../platform/common/platform/types.node'; -import { IExtensionContext, IHttpClient } from '../../platform/common/types'; -import { IKernel } from '../types'; -import { IIPyWidgetScriptManager, IIPyWidgetScriptManagerFactory, INbExtensionsPathProvider } from './types'; +import { IFileSystemNode } from '../../../../platform/common/platform/types.node'; +import { IExtensionContext, IHttpClient } from '../../../../platform/common/types'; +import { IKernel } from '../../../../kernels/types'; +import { IIPyWidgetScriptManager, IIPyWidgetScriptManagerFactory, INbExtensionsPathProvider } from '../types'; import { RemoteIPyWidgetScriptManager } from './remoteIPyWidgetScriptManager'; import { LocalIPyWidgetScriptManager } from './localIPyWidgetScriptManager.node'; -import { JupyterPaths } from '../raw/finder/jupyterPaths.node'; +import { JupyterPaths } from '../../../../kernels/raw/finder/jupyterPaths.node'; /** * Determines the IPyWidgetScriptManager for use in a node environment diff --git a/src/kernels/ipywidgets/ipyWidgetScriptManagerFactory.web.ts b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptManagerFactory.web.ts similarity index 86% rename from src/kernels/ipywidgets/ipyWidgetScriptManagerFactory.web.ts rename to src/notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptManagerFactory.web.ts index 567dd3ca003..4493ecdc211 100644 --- a/src/kernels/ipywidgets/ipyWidgetScriptManagerFactory.web.ts +++ b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptManagerFactory.web.ts @@ -3,11 +3,11 @@ // Licensed under the MIT License. import { injectable, inject } from 'inversify'; -import { IFileSystem } from '../../platform/common/platform/types'; -import { IExtensionContext, IHttpClient } from '../../platform/common/types'; -import { IKernel } from '../types'; +import { IFileSystem } from '../../../../platform/common/platform/types'; +import { IExtensionContext, IHttpClient } from '../../../../platform/common/types'; +import { IKernel } from '../../../../kernels/types'; import { RemoteIPyWidgetScriptManager } from './remoteIPyWidgetScriptManager'; -import { IIPyWidgetScriptManager, IIPyWidgetScriptManagerFactory } from './types'; +import { IIPyWidgetScriptManager, IIPyWidgetScriptManagerFactory } from '../types'; /** * Determines the IPyWidgetScriptManager for use in a web environment diff --git a/src/kernels/ipywidgets/ipyWidgetScriptSource.ts b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptSource.ts similarity index 93% rename from src/kernels/ipywidgets/ipyWidgetScriptSource.ts rename to src/notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptSource.ts index a81e0831845..ded5bcfeb21 100644 --- a/src/kernels/ipywidgets/ipyWidgetScriptSource.ts +++ b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptSource.ts @@ -4,18 +4,23 @@ 'use strict'; import type * as jupyterlabService from '@jupyterlab/services'; import { Event, EventEmitter, NotebookDocument, Uri } from 'vscode'; -import { traceError, traceInfo, traceVerbose, traceWarning } from '../../platform/logging'; -import { IDisposableRegistry, IConfigurationService, IHttpClient, IDisposable } from '../../platform/common/types'; -import { InteractiveWindowMessages, IPyWidgetMessages } from '../../messageTypes'; -import { sendTelemetryEvent, Telemetry } from '../../telemetry'; -import { IKernel, IKernelProvider } from '../types'; +import { traceError, traceInfo, traceVerbose, traceWarning } from '../../../../platform/logging'; +import { + IDisposableRegistry, + IConfigurationService, + IHttpClient, + IDisposable +} from '../../../../platform/common/types'; +import { InteractiveWindowMessages, IPyWidgetMessages } from '../../../../messageTypes'; +import { sendTelemetryEvent, Telemetry } from '../../../../telemetry'; +import { IKernel, IKernelProvider } from '../../../../kernels/types'; import { IPyWidgetScriptSourceProvider } from './ipyWidgetScriptSourceProvider'; -import { ILocalResourceUriConverter, IWidgetScriptSourceProviderFactory, WidgetScriptSource } from './types'; -import { ConsoleForegroundColors } from '../../platform/logging/types'; -import { noop } from '../../platform/common/utils/misc'; -import { createDeferred, Deferred } from '../../platform/common/utils/async'; +import { ILocalResourceUriConverter, IWidgetScriptSourceProviderFactory, WidgetScriptSource } from '../types'; +import { ConsoleForegroundColors } from '../../../../platform/logging/types'; +import { noop } from '../../../../platform/common/utils/misc'; +import { createDeferred, Deferred } from '../../../../platform/common/utils/async'; import { ScriptUriConverter } from './scriptUriConverter'; -import { ResourceMap } from '../../platform/vscode-path/map'; +import { ResourceMap } from '../../../../platform/vscode-path/map'; /** * Handles messages from the kernel related to setting up widgets. diff --git a/src/kernels/ipywidgets/ipyWidgetScriptSourceProvider.ts b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptSourceProvider.ts similarity index 91% rename from src/kernels/ipywidgets/ipyWidgetScriptSourceProvider.ts rename to src/notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptSourceProvider.ts index 6f85e542969..88a39dd5640 100644 --- a/src/kernels/ipywidgets/ipyWidgetScriptSourceProvider.ts +++ b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptSourceProvider.ts @@ -3,18 +3,18 @@ 'use strict'; -import '../../platform/common/extensions'; -import { traceError, traceInfo } from '../../platform/logging'; -import { WidgetCDNs, IConfigurationService, IHttpClient } from '../../platform/common/types'; -import { sendTelemetryEvent, Telemetry } from '../../telemetry'; -import { getTelemetrySafeHashedString } from '../../platform/telemetry/helpers'; -import { IKernel } from '../types'; +import '../../../../platform/common/extensions'; +import { traceError, traceInfo } from '../../../../platform/logging'; +import { WidgetCDNs, IConfigurationService, IHttpClient } from '../../../../platform/common/types'; +import { sendTelemetryEvent, Telemetry } from '../../../../telemetry'; +import { getTelemetrySafeHashedString } from '../../../../platform/telemetry/helpers'; +import { IKernel } from '../../../../kernels/types'; import { ILocalResourceUriConverter, IWidgetScriptSourceProvider, IWidgetScriptSourceProviderFactory, WidgetScriptSource -} from './types'; +} from '../types'; /** * This class decides where to get widget scripts from. diff --git a/src/kernels/ipywidgets/localIPyWidgetScriptManager.node.ts b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/localIPyWidgetScriptManager.node.ts similarity index 90% rename from src/kernels/ipywidgets/localIPyWidgetScriptManager.node.ts rename to src/notebooks/controllers/ipywidgets/scriptSourceProvider/localIPyWidgetScriptManager.node.ts index c80407b367a..31255fbbc99 100644 --- a/src/kernels/ipywidgets/localIPyWidgetScriptManager.node.ts +++ b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/localIPyWidgetScriptManager.node.ts @@ -1,17 +1,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import * as path from '../../platform/vscode-path/path'; +import * as path from '../../../../platform/vscode-path/path'; import { Uri } from 'vscode'; -import { IFileSystemNode } from '../../platform/common/platform/types.node'; -import { IExtensionContext } from '../../platform/common/types'; -import { StopWatch } from '../../platform/common/utils/stopWatch'; -import { sendTelemetryEvent, Telemetry } from '../../telemetry'; -import { getTelemetrySafeHashedString } from '../../platform/telemetry/helpers'; -import { IKernel } from '../types'; +import { IFileSystemNode } from '../../../../platform/common/platform/types.node'; +import { IExtensionContext } from '../../../../platform/common/types'; +import { StopWatch } from '../../../../platform/common/utils/stopWatch'; +import { sendTelemetryEvent, Telemetry } from '../../../../telemetry'; +import { getTelemetrySafeHashedString } from '../../../../platform/telemetry/helpers'; +import { IKernel } from '../../../../kernels/types'; import { BaseIPyWidgetScriptManager } from './baseIPyWidgetScriptManager'; -import { IIPyWidgetScriptManager, INbExtensionsPathProvider } from './types'; -import { JupyterPaths } from '../raw/finder/jupyterPaths.node'; +import { IIPyWidgetScriptManager, INbExtensionsPathProvider } from '../types'; +import { JupyterPaths } from '../../../../kernels/raw/finder/jupyterPaths.node'; type KernelConnectionId = string; /** diff --git a/src/kernels/ipywidgets/localWidgetScriptSourceProvider.node.ts b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/localWidgetScriptSourceProvider.node.ts similarity index 97% rename from src/kernels/ipywidgets/localWidgetScriptSourceProvider.node.ts rename to src/notebooks/controllers/ipywidgets/scriptSourceProvider/localWidgetScriptSourceProvider.node.ts index 09a86f9d4d8..0c0b0ba4e96 100644 --- a/src/kernels/ipywidgets/localWidgetScriptSourceProvider.node.ts +++ b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/localWidgetScriptSourceProvider.node.ts @@ -3,13 +3,13 @@ 'use strict'; -import { IKernel } from '../types'; +import { IKernel } from '../../../../kernels/types'; import { IIPyWidgetScriptManagerFactory, ILocalResourceUriConverter, IWidgetScriptSourceProvider, WidgetScriptSource -} from './types'; +} from '../types'; /** * Widget scripts are found in /share/jupyter/nbextensions. diff --git a/src/kernels/ipywidgets/nbExtensionsPathProvider.node.ts b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/nbExtensionsPathProvider.node.ts similarity index 91% rename from src/kernels/ipywidgets/nbExtensionsPathProvider.node.ts rename to src/notebooks/controllers/ipywidgets/scriptSourceProvider/nbExtensionsPathProvider.node.ts index 72deb40d6a4..d3e70b08161 100644 --- a/src/kernels/ipywidgets/nbExtensionsPathProvider.node.ts +++ b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/nbExtensionsPathProvider.node.ts @@ -3,8 +3,8 @@ import { injectable } from 'inversify'; import { Uri } from 'vscode'; -import { IKernel } from '../types'; -import { INbExtensionsPathProvider } from './types'; +import { IKernel } from '../../../../kernels/types'; +import { INbExtensionsPathProvider } from '../types'; /** * Returns the path to the nbExtensions folder for a given kernel (node) diff --git a/src/kernels/ipywidgets/nbExtensionsPathProvider.web.ts b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/nbExtensionsPathProvider.web.ts similarity index 88% rename from src/kernels/ipywidgets/nbExtensionsPathProvider.web.ts rename to src/notebooks/controllers/ipywidgets/scriptSourceProvider/nbExtensionsPathProvider.web.ts index e113ae0d49c..380f289cb25 100644 --- a/src/kernels/ipywidgets/nbExtensionsPathProvider.web.ts +++ b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/nbExtensionsPathProvider.web.ts @@ -3,8 +3,8 @@ import { injectable } from 'inversify'; import { Uri } from 'vscode'; -import { IKernel } from '../types'; -import { INbExtensionsPathProvider } from './types'; +import { IKernel } from '../../../../kernels/types'; +import { INbExtensionsPathProvider } from '../types'; /** * Returns the path to the nbExtensions folder for a given kernel (web) diff --git a/src/kernels/ipywidgets/remoteIPyWidgetScriptManager.ts b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/remoteIPyWidgetScriptManager.ts similarity index 89% rename from src/kernels/ipywidgets/remoteIPyWidgetScriptManager.ts rename to src/notebooks/controllers/ipywidgets/scriptSourceProvider/remoteIPyWidgetScriptManager.ts index fb5ceb6773a..c9279b199e5 100644 --- a/src/kernels/ipywidgets/remoteIPyWidgetScriptManager.ts +++ b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/remoteIPyWidgetScriptManager.ts @@ -2,18 +2,18 @@ // Licensed under the MIT License. import type * as nbformat from '@jupyterlab/nbformat'; -import * as path from '../../platform/vscode-path/path'; +import * as path from '../../../../platform/vscode-path/path'; import { ExtensionMode, Uri } from 'vscode'; -import { IExtensionContext, IHttpClient } from '../../platform/common/types'; -import { traceError, traceInfoIfCI } from '../../platform/logging'; -import { executeSilently, isPythonKernelConnection } from '../helpers'; -import { IKernel, RemoteKernelConnectionMetadata } from '../types'; -import { IIPyWidgetScriptManager } from './types'; +import { IExtensionContext, IHttpClient } from '../../../../platform/common/types'; +import { traceError, traceInfoIfCI } from '../../../../platform/logging'; +import { executeSilently, isPythonKernelConnection } from '../../../../kernels/helpers'; +import { IKernel, RemoteKernelConnectionMetadata } from '../../../../kernels/types'; +import { IIPyWidgetScriptManager } from '../types'; import { BaseIPyWidgetScriptManager } from './baseIPyWidgetScriptManager'; -import { isCI } from '../../platform/common/constants'; -import { sleep } from '../../platform/common/utils/async'; -import { noop } from '../../platform/common/utils/misc'; -import { IFileSystem } from '../../platform/common/platform/types'; +import { isCI } from '../../../../platform/common/constants'; +import { sleep } from '../../../../platform/common/utils/async'; +import { noop } from '../../../../platform/common/utils/misc'; +import { IFileSystem } from '../../../../platform/common/platform/types'; /** * IPyWidgetScriptManager for remote kernels diff --git a/src/kernels/ipywidgets/remoteWidgetScriptSourceProvider.ts b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/remoteWidgetScriptSourceProvider.ts similarity index 96% rename from src/kernels/ipywidgets/remoteWidgetScriptSourceProvider.ts rename to src/notebooks/controllers/ipywidgets/scriptSourceProvider/remoteWidgetScriptSourceProvider.ts index 81ff1b3ae1a..67955404808 100644 --- a/src/kernels/ipywidgets/remoteWidgetScriptSourceProvider.ts +++ b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/remoteWidgetScriptSourceProvider.ts @@ -4,13 +4,13 @@ 'use strict'; import { Uri } from 'vscode'; -import { IKernel, RemoteKernelConnectionMetadata } from '../types'; +import { IKernel, RemoteKernelConnectionMetadata } from '../../../../kernels/types'; import { IIPyWidgetScriptManager, IIPyWidgetScriptManagerFactory, IWidgetScriptSourceProvider, WidgetScriptSource -} from './types'; +} from '../types'; /** * When using a remote jupyter connection the widget scripts are accessible over diff --git a/src/kernels/ipywidgets/scriptSourceProviderFactory.node.ts b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/scriptSourceProviderFactory.node.ts similarity index 91% rename from src/kernels/ipywidgets/scriptSourceProviderFactory.node.ts rename to src/notebooks/controllers/ipywidgets/scriptSourceProvider/scriptSourceProviderFactory.node.ts index d9235b55193..668c375a47a 100644 --- a/src/kernels/ipywidgets/scriptSourceProviderFactory.node.ts +++ b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/scriptSourceProviderFactory.node.ts @@ -2,8 +2,8 @@ // Licensed under the MIT License. import { inject, injectable, named } from 'inversify'; -import { GLOBAL_MEMENTO, IConfigurationService, IHttpClient, IMemento } from '../../platform/common/types'; -import { IKernel } from '../types'; +import { GLOBAL_MEMENTO, IConfigurationService, IHttpClient, IMemento } from '../../../../platform/common/types'; +import { IKernel } from '../../../../kernels/types'; import { LocalWidgetScriptSourceProvider } from './localWidgetScriptSourceProvider.node'; import { RemoteWidgetScriptSourceProvider } from './remoteWidgetScriptSourceProvider'; import { @@ -11,8 +11,8 @@ import { ILocalResourceUriConverter, IWidgetScriptSourceProvider, IWidgetScriptSourceProviderFactory -} from './types'; -import { IApplicationShell } from '../../platform/common/application/types'; +} from '../types'; +import { IApplicationShell } from '../../../../platform/common/application/types'; import { Memento } from 'vscode'; import { CDNWidgetScriptSourceProvider } from './cdnWidgetScriptSourceProvider'; diff --git a/src/kernels/ipywidgets/scriptSourceProviderFactory.web.ts b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/scriptSourceProviderFactory.web.ts similarity index 90% rename from src/kernels/ipywidgets/scriptSourceProviderFactory.web.ts rename to src/notebooks/controllers/ipywidgets/scriptSourceProvider/scriptSourceProviderFactory.web.ts index 2a1dab851fb..dfd405b5151 100644 --- a/src/kernels/ipywidgets/scriptSourceProviderFactory.web.ts +++ b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/scriptSourceProviderFactory.web.ts @@ -3,9 +3,9 @@ import { inject, injectable, named } from 'inversify'; import { Memento } from 'vscode'; -import { IApplicationShell } from '../../platform/common/application/types'; -import { GLOBAL_MEMENTO, IConfigurationService, IHttpClient, IMemento } from '../../platform/common/types'; -import { IKernel } from '../types'; +import { IApplicationShell } from '../../../../platform/common/application/types'; +import { GLOBAL_MEMENTO, IConfigurationService, IHttpClient, IMemento } from '../../../../platform/common/types'; +import { IKernel } from '../../../../kernels/types'; import { CDNWidgetScriptSourceProvider } from './cdnWidgetScriptSourceProvider'; import { RemoteWidgetScriptSourceProvider } from './remoteWidgetScriptSourceProvider'; import { @@ -13,7 +13,7 @@ import { ILocalResourceUriConverter, IWidgetScriptSourceProvider, IWidgetScriptSourceProviderFactory -} from './types'; +} from '../types'; /** * Determines the IWidgetScriptSourceProvider for use in a web environment diff --git a/src/kernels/ipywidgets/scriptUriConverter.ts b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/scriptUriConverter.ts similarity index 95% rename from src/kernels/ipywidgets/scriptUriConverter.ts rename to src/notebooks/controllers/ipywidgets/scriptSourceProvider/scriptUriConverter.ts index 2f6671891cc..c2c2beb44ea 100644 --- a/src/kernels/ipywidgets/scriptUriConverter.ts +++ b/src/notebooks/controllers/ipywidgets/scriptSourceProvider/scriptUriConverter.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { Uri } from 'vscode'; -import { ILocalResourceUriConverter } from './types'; +import { ILocalResourceUriConverter } from '../types'; /** * Converts the uri of a widget script for loading in a vscode webview diff --git a/src/kernels/ipywidgets/serviceRegistry.node.ts b/src/notebooks/controllers/ipywidgets/serviceRegistry.node.ts similarity index 63% rename from src/kernels/ipywidgets/serviceRegistry.node.ts rename to src/notebooks/controllers/ipywidgets/serviceRegistry.node.ts index 182b077c6ff..1053efad411 100644 --- a/src/kernels/ipywidgets/serviceRegistry.node.ts +++ b/src/notebooks/controllers/ipywidgets/serviceRegistry.node.ts @@ -1,9 +1,9 @@ -import { IServiceManager } from '../../platform/ioc/types'; -import { ScriptSourceProviderFactory } from './scriptSourceProviderFactory.node'; +import { IServiceManager } from '../../../platform/ioc/types'; +import { ScriptSourceProviderFactory } from './scriptSourceProvider/scriptSourceProviderFactory.node'; import { IIPyWidgetScriptManagerFactory, INbExtensionsPathProvider, IWidgetScriptSourceProviderFactory } from './types'; -import { IPyWidgetMessageDispatcherFactory } from './ipyWidgetMessageDispatcherFactory'; -import { NbExtensionsPathProvider } from './nbExtensionsPathProvider.node'; -import { IPyWidgetScriptManagerFactory } from './ipyWidgetScriptManagerFactory.node'; +import { IPyWidgetMessageDispatcherFactory } from './message/ipyWidgetMessageDispatcherFactory'; +import { NbExtensionsPathProvider } from './scriptSourceProvider/nbExtensionsPathProvider.node'; +import { IPyWidgetScriptManagerFactory } from './scriptSourceProvider/ipyWidgetScriptManagerFactory.node'; export function registerTypes(serviceManager: IServiceManager, _isDevMode: boolean) { serviceManager.addSingleton( diff --git a/src/kernels/ipywidgets/serviceRegistry.web.ts b/src/notebooks/controllers/ipywidgets/serviceRegistry.web.ts similarity index 64% rename from src/kernels/ipywidgets/serviceRegistry.web.ts rename to src/notebooks/controllers/ipywidgets/serviceRegistry.web.ts index 92ca7b61c2a..bdc46a59237 100644 --- a/src/kernels/ipywidgets/serviceRegistry.web.ts +++ b/src/notebooks/controllers/ipywidgets/serviceRegistry.web.ts @@ -1,9 +1,9 @@ -import { IServiceManager } from '../../platform/ioc/types'; -import { ScriptSourceProviderFactory } from './scriptSourceProviderFactory.web'; +import { IServiceManager } from '../../../platform/ioc/types'; +import { ScriptSourceProviderFactory } from './scriptSourceProvider/scriptSourceProviderFactory.web'; import { IIPyWidgetScriptManagerFactory, INbExtensionsPathProvider, IWidgetScriptSourceProviderFactory } from './types'; -import { IPyWidgetMessageDispatcherFactory } from './ipyWidgetMessageDispatcherFactory'; -import { NbExtensionsPathProvider } from './nbExtensionsPathProvider.web'; -import { IPyWidgetScriptManagerFactory } from './ipyWidgetScriptManagerFactory.web'; +import { IPyWidgetMessageDispatcherFactory } from './message/ipyWidgetMessageDispatcherFactory'; +import { IPyWidgetScriptManagerFactory } from './scriptSourceProvider/ipyWidgetScriptManagerFactory.web'; +import { NbExtensionsPathProvider } from './scriptSourceProvider/nbExtensionsPathProvider.web'; export function registerTypes(serviceManager: IServiceManager, _isDevMode: boolean) { serviceManager.addSingleton( diff --git a/src/kernels/ipywidgets/types.ts b/src/notebooks/controllers/ipywidgets/types.ts similarity index 96% rename from src/kernels/ipywidgets/types.ts rename to src/notebooks/controllers/ipywidgets/types.ts index a239248197f..d6c65de1f9b 100644 --- a/src/kernels/ipywidgets/types.ts +++ b/src/notebooks/controllers/ipywidgets/types.ts @@ -4,9 +4,9 @@ 'use strict'; import { Event, Uri } from 'vscode'; -import { IDisposable, IHttpClient } from '../../platform/common/types'; -import { IPyWidgetMessages } from '../../messageTypes'; -import { IKernel } from '../types'; +import { IDisposable, IHttpClient } from '../../../platform/common/types'; +import { IPyWidgetMessages } from '../../../messageTypes'; +import { IKernel } from '../../../kernels/types'; export interface IPyWidgetMessage { message: IPyWidgetMessages; diff --git a/src/notebooks/controllers/notebookIPyWidgetCoordinator.ts b/src/notebooks/controllers/notebookIPyWidgetCoordinator.ts index 9abd4ef2406..2e715404206 100644 --- a/src/notebooks/controllers/notebookIPyWidgetCoordinator.ts +++ b/src/notebooks/controllers/notebookIPyWidgetCoordinator.ts @@ -21,7 +21,7 @@ import { IServiceContainer } from '../../platform/ioc/types'; import { IControllerSelection, IVSCodeNotebookController } from '../../notebooks/controllers/types'; import { IExtensionSyncActivationService } from '../../platform/activation/types'; import { IWebviewCommunication } from '../../platform/webviews/types'; -import { CommonMessageCoordinator } from '../../kernels/ipywidgets/commonMessageCoordinator'; +import { CommonMessageCoordinator } from './ipywidgets/message/commonMessageCoordinator'; /** * Posts/Receives messages from the renderer in order to have kernel messages available in the webview diff --git a/src/notebooks/controllers/serviceRegistry.node.ts b/src/notebooks/controllers/serviceRegistry.node.ts index 89984da9a1a..4e1f83c83a3 100644 --- a/src/notebooks/controllers/serviceRegistry.node.ts +++ b/src/notebooks/controllers/serviceRegistry.node.ts @@ -17,8 +17,9 @@ import { IControllerRegistration, IControllerSelection } from './types'; +import { registerTypes as registerWidgetTypes } from './ipywidgets/serviceRegistry.node'; -export function registerTypes(serviceManager: IServiceManager) { +export function registerTypes(serviceManager: IServiceManager, isDevMode: boolean) { serviceManager.addSingleton(IControllerRegistration, ControllerRegistration); serviceManager.addSingleton(IControllerDefaultService, ControllerDefaultService); serviceManager.addSingleton(IControllerLoader, ControllerLoader); @@ -26,4 +27,6 @@ export function registerTypes(serviceManager: IServiceManager) { serviceManager.addSingleton(IControllerPreferredService, ControllerPreferredService); serviceManager.addBinding(IControllerPreferredService, IExtensionSingleActivationService); serviceManager.addSingleton(IControllerSelection, ControllerSelection); + + registerWidgetTypes(serviceManager, isDevMode); } diff --git a/src/notebooks/controllers/serviceRegistry.web.ts b/src/notebooks/controllers/serviceRegistry.web.ts index 89984da9a1a..875377f27ce 100644 --- a/src/notebooks/controllers/serviceRegistry.web.ts +++ b/src/notebooks/controllers/serviceRegistry.web.ts @@ -17,8 +17,9 @@ import { IControllerRegistration, IControllerSelection } from './types'; +import { registerTypes as registerWidgetTypes } from './ipywidgets/serviceRegistry.web'; -export function registerTypes(serviceManager: IServiceManager) { +export function registerTypes(serviceManager: IServiceManager, isDevMode: boolean) { serviceManager.addSingleton(IControllerRegistration, ControllerRegistration); serviceManager.addSingleton(IControllerDefaultService, ControllerDefaultService); serviceManager.addSingleton(IControllerLoader, ControllerLoader); @@ -26,4 +27,6 @@ export function registerTypes(serviceManager: IServiceManager) { serviceManager.addSingleton(IControllerPreferredService, ControllerPreferredService); serviceManager.addBinding(IControllerPreferredService, IExtensionSingleActivationService); serviceManager.addSingleton(IControllerSelection, ControllerSelection); + + registerWidgetTypes(serviceManager, isDevMode); } diff --git a/src/notebooks/serviceRegistry.node.ts b/src/notebooks/serviceRegistry.node.ts index c7abcd5f902..bc6f1eee1a8 100644 --- a/src/notebooks/serviceRegistry.node.ts +++ b/src/notebooks/serviceRegistry.node.ts @@ -55,8 +55,8 @@ import { DebuggerVariables } from './debugger/debuggerVariables'; import { MultiplexingDebugService } from './debugger/multiplexingDebugService'; import { DebugLocationTrackerFactory } from './debugger/debugLocationTrackerFactory'; -export function registerTypes(serviceManager: IServiceManager) { - registerControllerTypes(serviceManager); +export function registerTypes(serviceManager: IServiceManager, isDevMode: boolean) { + registerControllerTypes(serviceManager, isDevMode); serviceManager.addSingleton(IExtensionSingleActivationService, RemoteSwitcher); serviceManager.addSingleton(IExtensionSyncActivationService, KernelFilterUI); serviceManager.addSingleton( diff --git a/src/notebooks/serviceRegistry.web.ts b/src/notebooks/serviceRegistry.web.ts index 598c8e85fb7..2562cf107f5 100644 --- a/src/notebooks/serviceRegistry.web.ts +++ b/src/notebooks/serviceRegistry.web.ts @@ -49,8 +49,8 @@ import { DebugLocationTrackerFactory } from './debugger/debugLocationTrackerFact import { IJupyterVariables } from '../kernels/variables/types'; import { DebuggerVariables } from './debugger/debuggerVariables'; -export function registerTypes(serviceManager: IServiceManager) { - registerControllerTypes(serviceManager); +export function registerTypes(serviceManager: IServiceManager, isDevMode: boolean) { + registerControllerTypes(serviceManager, isDevMode); serviceManager.addSingleton(IExtensionSingleActivationService, RemoteSwitcher); serviceManager.addSingleton(IExtensionSyncActivationService, KernelFilterUI); diff --git a/src/platform/common/constants.ts b/src/platform/common/constants.ts index 067fada9fc3..7c229792692 100644 --- a/src/platform/common/constants.ts +++ b/src/platform/common/constants.ts @@ -718,3 +718,5 @@ export const DataScienceStartupTime = Symbol('DataScienceStartupTime'); // Default for notebook version (major & minor) used when creating notebooks. export const defaultNotebookFormat = { major: 4, minor: 2 }; + +export const WIDGET_MIMETYPE = 'application/vnd.jupyter.widget-view+json'; diff --git a/src/test/datascience/ipywidgets/baseIPyWidgetScriptManager.unit.test.ts b/src/test/datascience/ipywidgets/baseIPyWidgetScriptManager.unit.test.ts index 9f1b34a1b8b..d9801a5b0e1 100644 --- a/src/test/datascience/ipywidgets/baseIPyWidgetScriptManager.unit.test.ts +++ b/src/test/datascience/ipywidgets/baseIPyWidgetScriptManager.unit.test.ts @@ -4,7 +4,7 @@ import { assert } from 'chai'; import * as fs from 'fs-extra'; import { Uri } from 'vscode'; -import { extractRequireConfigFromWidgetEntry } from '../../../kernels/ipywidgets/baseIPyWidgetScriptManager'; +import { extractRequireConfigFromWidgetEntry } from '../../../notebooks/controllers/ipywidgets/scriptSourceProvider/baseIPyWidgetScriptManager'; import * as path from '../../../platform/vscode-path/path'; import { EXTENSION_ROOT_DIR_FOR_TESTS } from '../../constants.node'; diff --git a/src/test/datascience/ipywidgets/cdnWidgetScriptSourceProvider.unit.test.ts b/src/test/datascience/ipywidgets/cdnWidgetScriptSourceProvider.unit.test.ts index d226c9a71cc..8b6892b8651 100644 --- a/src/test/datascience/ipywidgets/cdnWidgetScriptSourceProvider.unit.test.ts +++ b/src/test/datascience/ipywidgets/cdnWidgetScriptSourceProvider.unit.test.ts @@ -17,8 +17,8 @@ import { CDNWidgetScriptSourceProvider, GlobalStateKeyToNeverWarnAboutNoNetworkAccess, GlobalStateKeyToTrackIfUserConfiguredCDNAtLeastOnce -} from '../../../kernels/ipywidgets/cdnWidgetScriptSourceProvider'; -import { IWidgetScriptSourceProvider } from '../../../kernels/ipywidgets/types'; +} from '../../../notebooks/controllers/ipywidgets/scriptSourceProvider/cdnWidgetScriptSourceProvider'; +import { IWidgetScriptSourceProvider } from '../../../notebooks/controllers/ipywidgets/types'; import { HttpClient } from '../../../platform/common/net/httpClient'; import { IApplicationShell } from '../../../platform/common/application/types'; import { disposeAllDisposables } from '../../../platform/common/helpers'; diff --git a/src/test/datascience/ipywidgets/ipyWidgetScriptManager.vscode.common.test.ts b/src/test/datascience/ipywidgets/ipyWidgetScriptManager.vscode.common.test.ts index d88ca4ed5c0..8f09ae23a7a 100644 --- a/src/test/datascience/ipywidgets/ipyWidgetScriptManager.vscode.common.test.ts +++ b/src/test/datascience/ipywidgets/ipyWidgetScriptManager.vscode.common.test.ts @@ -19,10 +19,13 @@ import { initialize } from '../../initialize'; import { PYTHON_LANGUAGE } from '../../../platform/common/constants'; import { traceInfo } from '../../../platform/logging'; import { IKernel, IKernelProvider, isLocalConnection } from '../../../kernels/types'; -import { IIPyWidgetScriptManager, IIPyWidgetScriptManagerFactory } from '../../../kernels/ipywidgets/types'; import { getTelemetrySafeHashedString } from '../../../platform/telemetry/helpers'; import { IFileSystem } from '../../../platform/common/platform/types'; import { IFileSystemNode } from '../../../platform/common/platform/types.node'; +import { + IIPyWidgetScriptManager, + IIPyWidgetScriptManagerFactory +} from '../../../notebooks/controllers/ipywidgets/types'; suite('IPyWidget Script Manager', function () { this.timeout(120_000); diff --git a/src/test/datascience/ipywidgets/ipyWidgetScriptSourceProvider.unit.test.ts b/src/test/datascience/ipywidgets/ipyWidgetScriptSourceProvider.unit.test.ts index 8a076ab150e..cb81637d9eb 100644 --- a/src/test/datascience/ipywidgets/ipyWidgetScriptSourceProvider.unit.test.ts +++ b/src/test/datascience/ipywidgets/ipyWidgetScriptSourceProvider.unit.test.ts @@ -17,14 +17,17 @@ import { LocalKernelSpecConnectionMetadata, RemoteKernelSpecConnectionMetadata } from '../../../platform/../kernels/types'; -import { IPyWidgetScriptSourceProvider } from '../../../kernels/ipywidgets/ipyWidgetScriptSourceProvider'; -import { LocalWidgetScriptSourceProvider } from '../../../kernels/ipywidgets/localWidgetScriptSourceProvider.node'; -import { RemoteWidgetScriptSourceProvider } from '../../../kernels/ipywidgets/remoteWidgetScriptSourceProvider'; -import { ILocalResourceUriConverter, IWidgetScriptSourceProviderFactory } from '../../../kernels/ipywidgets/types'; -import { ScriptSourceProviderFactory } from '../../../kernels/ipywidgets/scriptSourceProviderFactory.node'; -import { CDNWidgetScriptSourceProvider } from '../../../kernels/ipywidgets/cdnWidgetScriptSourceProvider'; -import { IPyWidgetScriptManagerFactory } from '../../../kernels/ipywidgets/ipyWidgetScriptManagerFactory.node'; -import { NbExtensionsPathProvider } from '../../../kernels/ipywidgets/nbExtensionsPathProvider.node'; +import { IPyWidgetScriptSourceProvider } from '../../../notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptSourceProvider'; +import { LocalWidgetScriptSourceProvider } from '../../../notebooks/controllers/ipywidgets/scriptSourceProvider/localWidgetScriptSourceProvider.node'; +import { RemoteWidgetScriptSourceProvider } from '../../../notebooks/controllers/ipywidgets/scriptSourceProvider/remoteWidgetScriptSourceProvider'; +import { + ILocalResourceUriConverter, + IWidgetScriptSourceProviderFactory +} from '../../../notebooks/controllers/ipywidgets/types'; +import { ScriptSourceProviderFactory } from '../../../notebooks/controllers/ipywidgets/scriptSourceProvider/scriptSourceProviderFactory.node'; +import { CDNWidgetScriptSourceProvider } from '../../../notebooks/controllers/ipywidgets/scriptSourceProvider/cdnWidgetScriptSourceProvider'; +import { IPyWidgetScriptManagerFactory } from '../../../notebooks/controllers/ipywidgets/scriptSourceProvider/ipyWidgetScriptManagerFactory.node'; +import { NbExtensionsPathProvider } from '../../../notebooks/controllers/ipywidgets/scriptSourceProvider/nbExtensionsPathProvider.node'; import { JupyterPaths } from '../../../kernels/raw/finder/jupyterPaths.node'; /* eslint-disable @typescript-eslint/no-explicit-any, no-invalid-this */ diff --git a/src/test/datascience/ipywidgets/localWidgetScriptSourceProvider.unit.test.ts b/src/test/datascience/ipywidgets/localWidgetScriptSourceProvider.unit.test.ts index 6b177ae96d7..c03e9607416 100644 --- a/src/test/datascience/ipywidgets/localWidgetScriptSourceProvider.unit.test.ts +++ b/src/test/datascience/ipywidgets/localWidgetScriptSourceProvider.unit.test.ts @@ -4,13 +4,13 @@ import { assert } from 'chai'; import { anything, instance, mock, when } from 'ts-mockito'; import { Uri } from 'vscode'; import { IKernel } from '../../../platform/../kernels/types'; -import { LocalWidgetScriptSourceProvider } from '../../../kernels/ipywidgets/localWidgetScriptSourceProvider.node'; +import { LocalWidgetScriptSourceProvider } from '../../../notebooks/controllers/ipywidgets/scriptSourceProvider/localWidgetScriptSourceProvider.node'; import { ILocalResourceUriConverter, IWidgetScriptSourceProvider, IIPyWidgetScriptManager, IIPyWidgetScriptManagerFactory -} from '../../../kernels/ipywidgets/types'; +} from '../../../notebooks/controllers/ipywidgets/types'; /* eslint-disable , @typescript-eslint/no-explicit-any */ suite('DataScience - ipywidget - Local Widget Script Source', () => { diff --git a/src/test/datascience/ipywidgets/nbExtensionsPathProvider.unit.test.ts b/src/test/datascience/ipywidgets/nbExtensionsPathProvider.unit.test.ts index eae3e68408a..cc57e5a43fd 100644 --- a/src/test/datascience/ipywidgets/nbExtensionsPathProvider.unit.test.ts +++ b/src/test/datascience/ipywidgets/nbExtensionsPathProvider.unit.test.ts @@ -6,9 +6,9 @@ import * as path from '../../../platform/vscode-path/path'; import { assert } from 'chai'; import { when, mock, instance } from 'ts-mockito'; import { Uri } from 'vscode'; -import { NbExtensionsPathProvider } from '../../../kernels/ipywidgets/nbExtensionsPathProvider.node'; -import { NbExtensionsPathProvider as WebNbExtensionsPathProvider } from '../../../kernels/ipywidgets/nbExtensionsPathProvider.web'; -import { INbExtensionsPathProvider } from '../../../kernels/ipywidgets/types'; +import { NbExtensionsPathProvider } from '../../../notebooks/controllers/ipywidgets/scriptSourceProvider/nbExtensionsPathProvider.node'; +import { NbExtensionsPathProvider as WebNbExtensionsPathProvider } from '../../../notebooks/controllers/ipywidgets/scriptSourceProvider/nbExtensionsPathProvider.web'; +import { INbExtensionsPathProvider } from '../../../notebooks/controllers/ipywidgets/types'; import { IJupyterKernelSpec, IKernel, diff --git a/src/test/datascience/ipywidgets/remoteWidgetScriptSourceProvider.unit.test.ts b/src/test/datascience/ipywidgets/remoteWidgetScriptSourceProvider.unit.test.ts index 4e31e36af7b..d486a9fd5b9 100644 --- a/src/test/datascience/ipywidgets/remoteWidgetScriptSourceProvider.unit.test.ts +++ b/src/test/datascience/ipywidgets/remoteWidgetScriptSourceProvider.unit.test.ts @@ -4,9 +4,12 @@ import { assert } from 'chai'; import { anything, instance, mock, when } from 'ts-mockito'; import { Uri } from 'vscode'; import { IJupyterKernelSpec, IKernel, RemoteKernelConnectionMetadata } from '../../../platform/../kernels/types'; -import { IWidgetScriptSourceProvider } from '../../../kernels/ipywidgets/types'; -import { IIPyWidgetScriptManager, IIPyWidgetScriptManagerFactory } from '../../../kernels/ipywidgets/types'; -import { RemoteWidgetScriptSourceProvider } from '../../../kernels/ipywidgets/remoteWidgetScriptSourceProvider'; +import { IWidgetScriptSourceProvider } from '../../../notebooks/controllers/ipywidgets/types'; +import { + IIPyWidgetScriptManager, + IIPyWidgetScriptManagerFactory +} from '../../../notebooks/controllers/ipywidgets/types'; +import { RemoteWidgetScriptSourceProvider } from '../../../notebooks/controllers/ipywidgets/scriptSourceProvider/remoteWidgetScriptSourceProvider'; /* eslint-disable , @typescript-eslint/no-explicit-any */ suite('DataScience - ipywidget - Remote Widget Script Source', () => { diff --git a/src/test/datascience/widgets/thirdpartyWidgets.vscode.common.test.ts b/src/test/datascience/widgets/thirdpartyWidgets.vscode.common.test.ts index 685bbc4968e..08817da4045 100644 --- a/src/test/datascience/widgets/thirdpartyWidgets.vscode.common.test.ts +++ b/src/test/datascience/widgets/thirdpartyWidgets.vscode.common.test.ts @@ -33,7 +33,7 @@ import { executeCellAndWaitForOutput, initializeNotebookForWidgetTest } from './standardWidgets.vscode.common.test'; -import { GlobalStateKeyToTrackIfUserConfiguredCDNAtLeastOnce } from '../../../kernels/ipywidgets/cdnWidgetScriptSourceProvider'; +import { GlobalStateKeyToTrackIfUserConfiguredCDNAtLeastOnce } from '../../../notebooks/controllers/ipywidgets/scriptSourceProvider/cdnWidgetScriptSourceProvider'; [true, false].forEach((useCDN) => { /* eslint-disable @typescript-eslint/no-explicit-any, no-invalid-this */ diff --git a/src/webviews/webview-side/ipywidgets/common/incompatibleWidgetHandler.ts b/src/webviews/webview-side/ipywidgets/common/incompatibleWidgetHandler.ts index 79913efab62..94a4d2faa9f 100644 --- a/src/webviews/webview-side/ipywidgets/common/incompatibleWidgetHandler.ts +++ b/src/webviews/webview-side/ipywidgets/common/incompatibleWidgetHandler.ts @@ -4,7 +4,7 @@ 'use strict'; import * as semver from 'semver'; -import { WidgetScriptSource } from '../../../../kernels/ipywidgets/types'; +import { WidgetScriptSource } from '../../../../notebooks/controllers/ipywidgets/types'; const supportedVersionOfQgrid = '1.1.1'; const qgridModuleName = 'qgrid'; diff --git a/src/webviews/webview-side/ipywidgets/common/manager.ts b/src/webviews/webview-side/ipywidgets/common/manager.ts index 39c1b9f1922..f21b86f4b5f 100644 --- a/src/webviews/webview-side/ipywidgets/common/manager.ts +++ b/src/webviews/webview-side/ipywidgets/common/manager.ts @@ -16,10 +16,10 @@ import { logMessage, setLogger } from '../../react-common/logger'; import { IMessageHandler, PostOffice } from '../../react-common/postOffice'; import { create as createKernel } from './kernel'; import { IIPyWidgetManager, IJupyterLabWidgetManager, IJupyterLabWidgetManagerCtor, ScriptLoader } from './types'; -import { WIDGET_MIMETYPE } from '../../../../kernels/ipywidgets/constants'; import { KernelSocketOptions } from '../../../../kernels/types'; import { Deferred, createDeferred } from '../../../../platform/common/utils/async'; import { IInteractiveWindowMapping, IPyWidgetMessages, InteractiveWindowMessages } from '../../../../messageTypes'; +import { WIDGET_MIMETYPE } from '../../../../platform/common/constants'; /* eslint-disable @typescript-eslint/no-explicit-any */ diff --git a/src/webviews/webview-side/ipywidgets/common/requirejsRegistry.ts b/src/webviews/webview-side/ipywidgets/common/requirejsRegistry.ts index 7a0f03b8aea..c8c48a12308 100644 --- a/src/webviews/webview-side/ipywidgets/common/requirejsRegistry.ts +++ b/src/webviews/webview-side/ipywidgets/common/requirejsRegistry.ts @@ -3,7 +3,7 @@ 'use strict'; -import { WidgetScriptSource } from '../../../../kernels/ipywidgets/types'; +import { WidgetScriptSource } from '../../../../notebooks/controllers/ipywidgets/types'; import { logMessage } from '../../react-common/logger'; type NonPartial = { diff --git a/src/webviews/webview-side/ipywidgets/common/scriptManager.ts b/src/webviews/webview-side/ipywidgets/common/scriptManager.ts index dd58815c034..dc23e2ca578 100644 --- a/src/webviews/webview-side/ipywidgets/common/scriptManager.ts +++ b/src/webviews/webview-side/ipywidgets/common/scriptManager.ts @@ -10,7 +10,6 @@ import { warnAboutWidgetVersionsThatAreNotSupported } from '../common/incompatib import { registerScripts, undefineModule } from '../common/requirejsRegistry'; import { ScriptLoader } from './types'; import { logMessage } from '../../react-common/logger'; -import { WidgetScriptSource } from '../../../../kernels/ipywidgets/types'; import { Deferred, createDeferred } from '../../../../platform/common/utils/async'; import { SharedMessages, IPyWidgetMessages, IInteractiveWindowMapping } from '../../../../messageTypes'; import { IJupyterExtraSettings } from '../../../../platform/webviews/types'; @@ -18,6 +17,7 @@ import { isCDNReachable } from './helper'; import { noop } from '../../../../platform/common/utils/misc'; import { IDisposable } from '../../../../platform/common/types'; import { disposeAllDisposables } from '../../../../platform/common/helpers'; +import { WidgetScriptSource } from '../../../../notebooks/controllers/ipywidgets/types'; export class ScriptManager extends EventEmitter { public readonly widgetsRegisteredInRequireJs = new Set();