Change:
VSCode Version: 1.26.1 My extension provides syntax highlighting for the following files: <img width="147" alt="screen shot 2018-08-29 at 19 48 37" src="https://user-"When saving a new "Todo" file this will be the suggested name: <img width="368" alt="screen shot 2018-08-29 at 19 47 53" src="https://user-"Which doesn't really make sense, IMHO it should work like this: the first extension that starts with a dot, and suggest no extension starts with a dot pick the first one and suggest instead of
I would accept a reasonably small PR to fix this.

Discussion:
return mime.length === 1 && isUnspecific(mime[0]); } <ins> /** * Returns a suggestion for the filename by the following logic: * 1. If a relevant extension exists and is an actual filename extension (starting with a dot), suggest the prefix appended by the first one. * 2. Otherwise, if there are other extensions, suggest the first one. * 3. Otherwise, suggest the prefix. */ </ins> export function suggestFilename(langId: string, prefix: string): string { <del> for (let i = 0; i < registeredAssociations.length; i++) { const association = registeredAssociations[i]; if (association.userConfigured) { continue; // only support registered ones } if (association.id === langId && association.extension) { return prefix + association.extension; } </del> <ins> const extensions = registeredAssociations .filter(assoc => !assoc.userConfigured && assoc.extension && assoc.id === langId) .map(assoc => assoc.extension); const extensionsWithDotFirst = extensions .filter(assoc => strings.startsWith(assoc, '.')); if (extensionsWithDotFirst.length > 0) { return prefix + extensionsWithDotFirst[0]; </ins> } <del> return prefix; // without any known extension, just return the prefix </del> <ins> return extensions[0] || prefix; </ins> } interface MapExtToMediaMimes {

export function getMediaMime(path: string): string | undefined { const ext = paths.extname(path); return mapExtToMediaMimes[ext.toLowerCase()]; <del> } </del>  No newline at end of file <ins> } </ins>

'use strict'; import * as assert from 'assert'; <del> import { guessMimeTypes, registerTextMime } from 'vs/base/common/mime'; </del> <ins> import { guessMimeTypes, registerTextMime, suggestFilename } from 'vs/base/common/mime'; </ins> suite('Mime', () => { test('Dynamically Register Text Mime', () => {

let guess = guessMimeTypes('/some/path/dot.monaco.xml'); assert.deepEqual(guess, ['text/other', 'text/plain']); }); <ins> test('Filename Suggestion - Suggest prefix only when there are no relevant extensions', () => { const id = 'plumbus0'; const mime = `text/${id}`; for (let extension of ['one', 'two']) { registerTextMime({ id, mime, extension }); } let suggested = suggestFilename('shleem', 'Untitled-1'); assert.equal(suggested, 'Untitled-1'); }); test('Filename Suggestion - Suggest prefix with first extension that begins with a dot', () => { const id = 'plumbus1'; const mime = `text/${id}`; for (let extension of ['plumbus', '.shleem', '.gazorpazorp']) { registerTextMime({ id, mime, extension }); } let suggested = suggestFilename('plumbus1', 'Untitled-1'); assert.equal(suggested, 'Untitled-1.shleem'); }); test('Filename Suggestion - Suggest first relevant extension when there are none that begin with a dot', () => { const id = 'plumbus2'; const mime = `text/${id}`; for (let extension of ['plumbus', 'shleem', 'gazorpazorp']) { registerTextMime({ id, mime, extension }); } let suggested = suggestFilename('plumbus2', 'Untitled-1'); assert.equal(suggested, 'plumbus'); }); test('Filename Suggestion - Should ignore user-configured associations', () => { registerTextMime({ id: 'plumbus3', mime: 'text/plumbus3', extension: 'plumbus', userConfigured: true }); registerTextMime({ id: 'plumbus3', mime: 'text/plumbus3', extension: '.shleem', userConfigured: true }); registerTextMime({ id: 'plumbus3', mime: 'text/plumbus3', extension: '.gazorpazorp', userConfigured: false }); let suggested = suggestFilename('plumbus3', 'Untitled-1'); assert.equal(suggested, 'Untitled-1.gazorpazorp'); registerTextMime({ id: 'plumbus4', mime: 'text/plumbus4', extension: 'plumbus', userConfigured: true }); registerTextMime({ id: 'plumbus4', mime: 'text/plumbus4', extension: '.shleem', userConfigured: true }); registerTextMime({ id: 'plumbus4', mime: 'text/plumbus4', extension: '.gazorpazorp', userConfigured: true }); suggested = suggestFilename('plumbus4', 'Untitled-1'); assert.equal(suggested, 'Untitled-1'); }); </ins> });