Skip to content

Commit

Permalink
fix #5017: detect languages on mime associations change
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
  • Loading branch information
akosyakov committed May 14, 2020
1 parent 4b6bccf commit 55af692
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/monaco/src/browser/monaco-mime-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export class MonacoMimeService extends MimeService {
const mimetype = this.getMimeForMode(association.id) || `text/x-${association.id}`;
monaco.mime.registerTextMime({ id: association.id, mime: mimetype, filepattern: association.filepattern, userConfigured: true }, false);
}

monaco.services.StaticServices.modeService.get()._onLanguagesMaybeChanged.fire(undefined);
}

protected getMimeForMode(langId: string): string | undefined {
Expand Down
1 change: 1 addition & 0 deletions packages/monaco/src/typings/monaco/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ declare module monaco.services {
export interface IModeService {
// https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/services/modeServiceImpl.ts#L46
private readonly _instantiatedModes: { [modeId: string]: IMode; };
private readonly _onLanguagesMaybeChanged: Emitter<void>;
readonly onDidCreateMode: monaco.IEvent<IMode>;
createByFilepathOrFirstLine(rsource: monaco.Uri | null, firstLine?: string): ILanguageSelection;
getLanguageIdentifier(modeId: string | LanguageId): LanguageIdentifier | null;
Expand Down

0 comments on commit 55af692

Please sign in to comment.