diff --git a/src/vs/editor/common/services/languagesRegistry.ts b/src/vs/editor/common/services/languagesRegistry.ts index 194afe1fac821..1b39d594b48e5 100644 --- a/src/vs/editor/common/services/languagesRegistry.ts +++ b/src/vs/editor/common/services/languagesRegistry.ts @@ -15,6 +15,7 @@ import { NULL_LANGUAGE_IDENTIFIER, NULL_MODE_ID } from 'vs/editor/common/modes/n import { ILanguageExtensionPoint } from 'vs/editor/common/services/modeService'; import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; import { Registry } from 'vs/platform/registry/common/platform'; +import { ThemeIcon } from 'vs/platform/theme/common/themeService'; const hasOwnProperty = Object.prototype.hasOwnProperty; @@ -26,7 +27,7 @@ export interface IResolvedLanguage { extensions: string[]; filenames: string[]; configurationFiles: URI[]; - icons: string[]; + icons: ThemeIcon[]; } export class LanguagesRegistry extends Disposable { @@ -231,7 +232,7 @@ export class LanguagesRegistry extends Disposable { } if (lang.icon) { - resolvedLanguage.icons.push(lang.icon); + resolvedLanguage.icons.push({ id: lang.icon }); } } @@ -281,7 +282,7 @@ export class LanguagesRegistry extends Disposable { return (language.mimetypes[0] || null); } - public getIconForMode(modeId: string): string | null { + public getIconForMode(modeId: string): ThemeIcon | null { if (!hasOwnProperty.call(this._languages, modeId)) { return null; } diff --git a/src/vs/editor/common/services/modeService.ts b/src/vs/editor/common/services/modeService.ts index 7b66fe0b7c1f5..df6759376378b 100644 --- a/src/vs/editor/common/services/modeService.ts +++ b/src/vs/editor/common/services/modeService.ts @@ -7,6 +7,7 @@ import { Event } from 'vs/base/common/event'; import { URI } from 'vs/base/common/uri'; import { IMode, LanguageId, LanguageIdentifier } from 'vs/editor/common/modes'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; +import { ThemeIcon } from 'vs/platform/theme/common/themeService'; export const IModeService = createDecorator('modeService'); @@ -40,7 +41,7 @@ export interface IModeService { getExtensions(alias: string): string[]; getFilenames(alias: string): string[]; getMimeForMode(modeId: string): string | null; - getIconForMode(modeId: string): string | null; + getIconForMode(modeId: string): ThemeIcon | null; getLanguageName(modeId: string): string | null; getModeIdForLanguageName(alias: string): string | null; getModeIdByFilepathOrFirstLine(resource: URI, firstLine?: string): string | null; diff --git a/src/vs/editor/common/services/modeServiceImpl.ts b/src/vs/editor/common/services/modeServiceImpl.ts index 38db18e569cd3..e61b81a383cd2 100644 --- a/src/vs/editor/common/services/modeServiceImpl.ts +++ b/src/vs/editor/common/services/modeServiceImpl.ts @@ -12,6 +12,7 @@ import { NULL_LANGUAGE_IDENTIFIER } from 'vs/editor/common/modes/nullMode'; import { LanguagesRegistry } from 'vs/editor/common/services/languagesRegistry'; import { ILanguageSelection, IModeService } from 'vs/editor/common/services/modeService'; import { firstOrDefault } from 'vs/base/common/arrays'; +import { ThemeIcon } from 'vs/platform/theme/common/themeService'; class LanguageSelection implements ILanguageSelection { @@ -96,7 +97,7 @@ export class ModeServiceImpl extends Disposable implements IModeService { return this._registry.getMimeForMode(modeId); } - public getIconForMode(modeId: string): string | null { + public getIconForMode(modeId: string): ThemeIcon | null { return this._registry.getIconForMode(modeId); } diff --git a/src/vs/workbench/services/themes/browser/fileIconThemeData.ts b/src/vs/workbench/services/themes/browser/fileIconThemeData.ts index ff95f1d075841..51cbb89969b18 100644 --- a/src/vs/workbench/services/themes/browser/fileIconThemeData.ts +++ b/src/vs/workbench/services/themes/browser/fileIconThemeData.ts @@ -386,8 +386,8 @@ class FileIconThemeLoader { } for (let languageId in selectorByModeIdForMissingLanguages) { - const iconName = modeService.getIconForMode(languageId); - const contribution = getIconRegistry().getIcon(iconName!); + const themeIcon = modeService.getIconForMode(languageId); + const contribution = getIconRegistry().getIcon(themeIcon!.id!); if (contribution) { let definition: IconDefaults | null = contribution.defaults; while (ThemeIcon.isThemeIcon(definition)) {