Skip to content

Commit 374fc26

Browse files
committed
add IIntegrationManager interface
1 parent 0b4cf4d commit 374fc26

File tree

6 files changed

+29
-11
lines changed

6 files changed

+29
-11
lines changed

src/notebooks/deepnote/deepnoteActivationService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { IExtensionContext } from '../../platform/common/types';
55
import { IDeepnoteNotebookManager } from '../types';
66
import { DeepnoteNotebookSerializer } from './deepnoteSerializer';
77
import { DeepnoteExplorerView } from './deepnoteExplorerView';
8-
import { IntegrationManager } from './integrations/integrationManager';
8+
import { IIntegrationManager } from './integrations/types';
99

1010
/**
1111
* Service responsible for activating and configuring Deepnote notebook support in VS Code.
@@ -15,14 +15,14 @@ import { IntegrationManager } from './integrations/integrationManager';
1515
export class DeepnoteActivationService implements IExtensionSyncActivationService {
1616
private explorerView: DeepnoteExplorerView;
1717

18-
private integrationManager: IntegrationManager;
18+
private integrationManager: IIntegrationManager;
1919

2020
private serializer: DeepnoteNotebookSerializer;
2121

2222
constructor(
2323
@inject(IExtensionContext) private extensionContext: IExtensionContext,
2424
@inject(IDeepnoteNotebookManager) private readonly notebookManager: IDeepnoteNotebookManager,
25-
@inject(IntegrationManager) integrationManager: IntegrationManager
25+
@inject(IIntegrationManager) integrationManager: IIntegrationManager
2626
) {
2727
this.integrationManager = integrationManager;
2828
}

src/notebooks/deepnote/deepnoteActivationService.unit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import { assert } from 'chai';
33
import { DeepnoteActivationService } from './deepnoteActivationService';
44
import { DeepnoteNotebookManager } from './deepnoteNotebookManager';
55
import { IExtensionContext } from '../../platform/common/types';
6-
import { IntegrationManager } from './integrations/integrationManager';
6+
import { IIntegrationManager } from './integrations/types';
77

88
suite('DeepnoteActivationService', () => {
99
let activationService: DeepnoteActivationService;
1010
let mockExtensionContext: IExtensionContext;
1111
let manager: DeepnoteNotebookManager;
12-
let mockIntegrationManager: IntegrationManager;
12+
let mockIntegrationManager: IIntegrationManager;
1313

1414
setup(() => {
1515
mockExtensionContext = {

src/notebooks/deepnote/integrations/integrationManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import { commands, NotebookDocument, window, workspace } from 'vscode';
44
import { IExtensionContext } from '../../../platform/common/types';
55
import { Commands } from '../../../platform/common/constants';
66
import { logger } from '../../../platform/logging';
7-
import { IIntegrationDetector, IIntegrationStorage, IIntegrationWebviewProvider } from './types';
7+
import { IIntegrationDetector, IIntegrationManager, IIntegrationStorage, IIntegrationWebviewProvider } from './types';
88
import { IntegrationStatus, IntegrationWithStatus } from './integrationTypes';
99
import { BlockWithIntegration, scanBlocksForIntegrations } from './integrationUtils';
1010

1111
/**
1212
* Manages integration UI and commands for Deepnote notebooks
1313
*/
1414
@injectable()
15-
export class IntegrationManager {
15+
export class IntegrationManager implements IIntegrationManager {
1616
private hasIntegrationsContext = 'deepnote.hasIntegrations';
1717

1818
private hasUnconfiguredIntegrationsContext = 'deepnote.hasUnconfiguredIntegrations';

src/notebooks/deepnote/integrations/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,11 @@ export interface IIntegrationWebviewProvider {
3030
*/
3131
show(integrations: Map<string, IntegrationWithStatus>): Promise<void>;
3232
}
33+
34+
export const IIntegrationManager = Symbol('IIntegrationManager');
35+
export interface IIntegrationManager {
36+
/**
37+
* Activate the integration manager by registering commands and event listeners
38+
*/
39+
activate(): void;
40+
}

src/notebooks/serviceRegistry.node.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ import { IntegrationStorage } from './deepnote/integrations/integrationStorage';
4747
import { IntegrationDetector } from './deepnote/integrations/integrationDetector';
4848
import { IntegrationManager } from './deepnote/integrations/integrationManager';
4949
import { IntegrationWebviewProvider } from './deepnote/integrations/integrationWebview';
50-
import { IIntegrationDetector, IIntegrationStorage, IIntegrationWebviewProvider } from './deepnote/integrations/types';
50+
import {
51+
IIntegrationDetector,
52+
IIntegrationManager,
53+
IIntegrationStorage,
54+
IIntegrationWebviewProvider
55+
} from './deepnote/integrations/types';
5156
import {
5257
IDeepnoteToolkitInstaller,
5358
IDeepnoteServerStarter,
@@ -136,7 +141,7 @@ export function registerTypes(serviceManager: IServiceManager, isDevMode: boolea
136141
serviceManager.addSingleton<IIntegrationStorage>(IIntegrationStorage, IntegrationStorage);
137142
serviceManager.addSingleton<IIntegrationDetector>(IIntegrationDetector, IntegrationDetector);
138143
serviceManager.addSingleton<IIntegrationWebviewProvider>(IIntegrationWebviewProvider, IntegrationWebviewProvider);
139-
serviceManager.addSingleton<IntegrationManager>(IntegrationManager, IntegrationManager);
144+
serviceManager.addSingleton<IIntegrationManager>(IIntegrationManager, IntegrationManager);
140145

141146
// Deepnote kernel services
142147
serviceManager.addSingleton<IDeepnoteToolkitInstaller>(IDeepnoteToolkitInstaller, DeepnoteToolkitInstaller);

src/notebooks/serviceRegistry.web.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ import { IntegrationStorage } from './deepnote/integrations/integrationStorage';
4242
import { IntegrationDetector } from './deepnote/integrations/integrationDetector';
4343
import { IntegrationManager } from './deepnote/integrations/integrationManager';
4444
import { IntegrationWebviewProvider } from './deepnote/integrations/integrationWebview';
45-
import { IIntegrationDetector, IIntegrationStorage, IIntegrationWebviewProvider } from './deepnote/integrations/types';
45+
import {
46+
IIntegrationDetector,
47+
IIntegrationManager,
48+
IIntegrationStorage,
49+
IIntegrationWebviewProvider
50+
} from './deepnote/integrations/types';
4651

4752
export function registerTypes(serviceManager: IServiceManager, isDevMode: boolean) {
4853
registerControllerTypes(serviceManager, isDevMode);
@@ -100,7 +105,7 @@ export function registerTypes(serviceManager: IServiceManager, isDevMode: boolea
100105
serviceManager.addSingleton<IIntegrationStorage>(IIntegrationStorage, IntegrationStorage);
101106
serviceManager.addSingleton<IIntegrationDetector>(IIntegrationDetector, IntegrationDetector);
102107
serviceManager.addSingleton<IIntegrationWebviewProvider>(IIntegrationWebviewProvider, IntegrationWebviewProvider);
103-
serviceManager.addSingleton<IntegrationManager>(IntegrationManager, IntegrationManager);
108+
serviceManager.addSingleton<IIntegrationManager>(IIntegrationManager, IntegrationManager);
104109

105110
serviceManager.addSingleton<IExportBase>(IExportBase, ExportBase);
106111
serviceManager.addSingleton<IFileConverter>(IFileConverter, FileConverter);

0 commit comments

Comments
 (0)