Change:
classes.push(`ext-file-icon`); // extra segment to increase file-ext score } <del> // Configured Language let configuredLangId: string | null = getConfiguredLangId(modelService, modeService, resource); configuredLangId = configuredLangId || (path ? modeService.getModeIdByFilepathOrFirstLine(path) : null); if (configuredLangId) { classes.push(`${cssEscape(configuredLangId)}-lang-file-icon`); </del> <ins> // Detected Mode const detectedModeId = detectModeId(modelService, modeService, resource); if (detectedModeId) { classes.push(`${cssEscape(detectedModeId)}-lang-file-icon`); </ins> } } } return classes; } <del> export function getConfiguredLangId(modelService: IModelService, modeService: IModeService, resource: uri): string | null { let configuredLangId: string | null = null; if (resource) { let modeId: string | null = null; </del> <ins> export function detectModeId(modelService: IModelService, modeService: IModeService, resource: uri): string | null { if (!resource) { return null; // we need a resource at least } </ins> <del> // Data URI: check for encoded metadata if (resource.scheme === Schemas.data) { const metadata = DataUri.parseMetaData(resource); const mime = metadata.get(DataUri.META_DATA_MIME); </del> <ins> let modeId: string | null = null; </ins> <del> if (mime) { modeId = modeService.getModeId(mime); } } </del> <ins> // Data URI: check for encoded metadata if (resource.scheme === Schemas.data) { const metadata = DataUri.parseMetaData(resource); const mime = metadata.get(DataUri.META_DATA_MIME); </ins> <del> // Any other URI: check for model if existing else { const model = modelService.getModel(resource); if (model) { modeId = model.getLanguageIdentifier().language; } </del> <ins> if (mime) { modeId = modeService.getModeId(mime); </ins> } <ins> } </ins> <del> if (modeId && modeId !== PLAINTEXT_MODE_ID) { configuredLangId = modeId; // only take if the mode is specific (aka no just plain text) </del> <ins> // Any other URI: check for model if existing else { const model = modelService.getModel(resource); if (model) { modeId = model.getModeId(); </ins> } } <del> return configuredLangId; </del> <ins> // only take if the mode is specific (aka no just plain text) if (modeId && modeId !== PLAINTEXT_MODE_ID) { return modeId; } // otherwise fallback to path based detection let path: string | undefined; if (resource.scheme === Schemas.data) { const metadata = DataUri.parseMetaData(resource); path = metadata.get(DataUri.META_DATA_LABEL); } else { path = resource.path.toLowerCase(); } if (path) { return modeService.getModeIdByFilepathOrFirstLine(path); } return null; // finally - we do not know the mode id </ins> } export function cssEscape(val: string): string {

Discussion:
Issue Type: <bBug</bto something like . a new tab. The tab should have the Markdown icon, but it has the Plain Text icon. If you move to another tab then back, the icon will be updated. This only started happening when I updated to 1.3, and it's still happening in Insiders. I've got no extensions or settings (other than ) set. VS Code version: Code - Insiders 1.31.0-insider (, 2018-12-21T06:14:53.023Z) OS version: Darwin x64 18.2.0 <!-- generated by issue reporter --
This is a consequence of adopting : When the tab opens we immediately render the icon, but the resource only gets the mode associated after a on the end of the tick.
via