Skip to content

Commit 10d16bd

Browse files
committed
Reduce usage of onDidRegisterExtensions
1 parent 044c205 commit 10d16bd

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/vs/editor/common/services/modeService.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export interface IModeService {
3131
_serviceBrand: undefined;
3232

3333
onDidCreateMode: Event<IMode>;
34+
onLanguagesMaybeChanged: Event<void>;
3435

3536
// --- reading
3637
isRegisteredMode(mimetypeOrModeId: string): boolean;

src/vs/editor/common/services/modeServiceImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class ModeServiceImpl implements IModeService {
5050
public readonly onDidCreateMode: Event<IMode> = this._onDidCreateMode.event;
5151

5252
protected readonly _onLanguagesMaybeChanged = new Emitter<void>();
53-
private readonly onLanguagesMaybeChanged: Event<void> = this._onLanguagesMaybeChanged.event;
53+
public readonly onLanguagesMaybeChanged: Event<void> = this._onLanguagesMaybeChanged.event;
5454

5555
constructor(warnOnOverwrite = false) {
5656
this._instantiatedModes = {};

src/vs/workbench/browser/labels.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import { URI } from 'vs/base/common/uri';
77
import { dirname, isEqual, basenameOrAuthority } from 'vs/base/common/resources';
88
import { IconLabel, IIconLabelValueOptions, IIconLabelCreationOptions } from 'vs/base/browser/ui/iconLabel/iconLabel';
9-
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
109
import { IModeService } from 'vs/editor/common/services/modeService';
1110
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
1211
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@@ -82,9 +81,9 @@ export class ResourceLabels extends Disposable {
8281
constructor(
8382
container: IResourceLabelsContainer,
8483
@IInstantiationService private readonly instantiationService: IInstantiationService,
85-
@IExtensionService private readonly extensionService: IExtensionService,
8684
@IConfigurationService private readonly configurationService: IConfigurationService,
8785
@IModelService private readonly modelService: IModelService,
86+
@IModeService private readonly modeService: IModeService,
8887
@IDecorationsService private readonly decorationsService: IDecorationsService,
8988
@IThemeService private readonly themeService: IThemeService,
9089
@ILabelService private readonly labelService: ILabelService,
@@ -103,7 +102,7 @@ export class ResourceLabels extends Disposable {
103102
}));
104103

105104
// notify when extensions are registered with potentially new languages
106-
this._register(this.extensionService.onDidRegisterExtensions(() => this._widgets.forEach(widget => widget.notifyExtensionsRegistered())));
105+
this._register(this.modeService.onLanguagesMaybeChanged(() => this._widgets.forEach(widget => widget.notifyExtensionsRegistered())));
107106

108107
// notify when model mode changes
109108
this._register(this.modelService.onModelModeChanged(e => {
@@ -206,15 +205,15 @@ export class ResourceLabel extends ResourceLabels {
206205
container: HTMLElement,
207206
options: IIconLabelCreationOptions | undefined,
208207
@IInstantiationService instantiationService: IInstantiationService,
209-
@IExtensionService extensionService: IExtensionService,
210208
@IConfigurationService configurationService: IConfigurationService,
211209
@IModelService modelService: IModelService,
210+
@IModelService modeService: IModeService,
212211
@IDecorationsService decorationsService: IDecorationsService,
213212
@IThemeService themeService: IThemeService,
214213
@ILabelService labelService: ILabelService,
215214
@ITextFileService textFileService: ITextFileService
216215
) {
217-
super(DEFAULT_LABELS_CONTAINER, instantiationService, extensionService, configurationService, modelService, decorationsService, themeService, labelService, textFileService);
216+
super(DEFAULT_LABELS_CONTAINER, instantiationService, configurationService, modelService, modeService, decorationsService, themeService, labelService, textFileService);
218217

219218
this._label = this._register(this.create(container, options));
220219
}

0 commit comments

Comments
 (0)