Skip to content

Commit

Permalink
Fix IJupyterExtensionBanner service identifier (#4825)
Browse files Browse the repository at this point in the history
  • Loading branch information
joyceerhl authored Feb 16, 2021
1 parent 88d1d0f commit cfc328a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
9 changes: 3 additions & 6 deletions src/client/activation/serviceRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { BANNER_NAME_DS_SURVEY, BANNER_NAME_INTERACTIVE_SHIFTENTER, IJupyterExtensionBanner } from '../common/types';
import { BANNER_NAME_INTERACTIVE_SHIFTENTER, IJupyterExtensionBanner, ISurveyBanner } from '../common/types';
import { DataScienceSurveyBanner } from '../datascience/dataScienceSurveyBanner';
import { RecommendPythonExtensionBanner } from '../datascience/recommendPythonExtensionBanner';
import { InteractiveShiftEnterBanner } from '../datascience/shiftEnterBanner';
Expand All @@ -18,11 +18,8 @@ export function registerTypes(serviceManager: IServiceManager) {
IExtensionActivationService,
MigrateDataScienceSettingsService
);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
DataScienceSurveyBanner,
BANNER_NAME_DS_SURVEY
);
serviceManager.addSingleton<ISurveyBanner>(ISurveyBanner, DataScienceSurveyBanner);
serviceManager.addBinding(ISurveyBanner, IExtensionSingleActivationService);
serviceManager.addSingleton<IJupyterExtensionBanner>(
IJupyterExtensionBanner,
InteractiveShiftEnterBanner,
Expand Down
5 changes: 4 additions & 1 deletion src/client/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
Uri,
WorkspaceEdit
} from 'vscode';
import { IExtensionSingleActivationService } from '../activation/types';
import { BannerType } from '../datascience/dataScienceSurveyBanner';
import { LogLevel } from '../logging/levels';
import { CommandsWithoutArgs } from './application/commands';
Expand Down Expand Up @@ -329,9 +330,11 @@ export interface IJupyterExtensionBanner {
isEnabled(type: BannerType): boolean;
showBanner(type: BannerType): Promise<void>;
}
export const BANNER_NAME_DS_SURVEY: string = 'DSSurveyBanner';
export const BANNER_NAME_INTERACTIVE_SHIFTENTER: string = 'InteractiveShiftEnterBanner';

export const ISurveyBanner = Symbol('ISurveyBanner');
export interface ISurveyBanner extends IExtensionSingleActivationService, IJupyterExtensionBanner {}

export type DeprecatedSettingAndValue = {
setting: string;
values?: {}[];
Expand Down
11 changes: 5 additions & 6 deletions src/client/datascience/dataScienceSurveyBanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

'use strict';

import { inject, injectable, named } from 'inversify';
import { inject, injectable } from 'inversify';
import { Event, EventEmitter, UIKind } from 'vscode';
import { IExtensionSingleActivationService } from '../activation/types';
import { IApplicationEnvironment, IApplicationShell, IVSCodeNotebook } from '../common/application/types';
Expand All @@ -12,13 +12,13 @@ import { Experiments } from '../common/experiments/groups';
import '../common/extensions';
import { traceError } from '../common/logger';
import {
BANNER_NAME_DS_SURVEY,
IBrowserService,
IDisposableRegistry,
IExperimentService,
IJupyterExtensionBanner,
IPersistentState,
IPersistentStateFactory
IPersistentStateFactory,
ISurveyBanner
} from '../common/types';
import * as localize from '../common/utils/localize';
import { noop } from '../common/utils/misc';
Expand Down Expand Up @@ -65,9 +65,8 @@ export class DataScienceSurveyBannerLogger implements IInteractiveWindowListener
private postEmitter = new EventEmitter<{ message: string; payload: any }>();
constructor(
@inject(IPersistentStateFactory) private persistentState: IPersistentStateFactory,
@inject(IJupyterExtensionBanner)
@named(BANNER_NAME_DS_SURVEY)
private readonly dataScienceSurveyBanner: IJupyterExtensionBanner
@inject(ISurveyBanner)
private readonly dataScienceSurveyBanner: ISurveyBanner
) {}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public get postMessage(): Event<{ message: string; payload: any }> {
Expand Down

0 comments on commit cfc328a

Please sign in to comment.