src/vs/workbench/common/editor/textEditorModel.ts/BaseTextEditorModel/getOrCreateMode
class BaseTextEditorModel:	protected getOrCreateMode(resource: URI | undefined, modeService: IModeService, preferredMode: string | undefined, firstLineText?: string): ILanguageSelection {

		// lookup mode via resource path if the provided mode is unspecific
		if (!preferredMode || preferredMode === PLAINTEXT_MODE_ID) {
			return modeService.createByFilepathOrFirstLine(withUndefinedAsNull(resource), firstLineText);
		}

		// otherwise take the preferred mode for granted
		return modeService.create(preferredMode);
	}