Skip to content

Support font family picker in settings #128355

@Tyriar

Description

@Tyriar

Currently our font pickers don't know anything about system fonts:

image

image

By enabling and using the font access API we can provide suggestions for this which is really nice:

image

image

Unfortunately this doesn't work well currently when syncing across machines and/or using font fallbacks as warnings will appear. For example this is valid on this machine but it throws an error:

image

I've tried a few things but none of them work:

  • The example JSON schema property is what we're after, optional suggestions, but we don't seem to support it.
  • Using pattern: '.*' in combination with enum still warns about not matching an enum value.
  • This works but is a bit hacky to avoid matching both oneOf values and it doesn't show up in the settings UI. anyOf doesn't work:
    oneOf: [
    	{
    		type: 'string',
    		enum: fontFamilies,
    		enumDescriptions: [`The system's default monospace font`],
    	},
    	{
    		type: 'string',
    		pattern: `^(?!(${fontFamilies.join('|')})).*`
    	}
    ]
    

Ideally any string value would be accepted and we would have a combobox in the settings editor to allow selecting from a dropdown or manual freeform entry.

@aeschli Am I interpreting example correctly and could we update the schema parsing to support it?
@roblourens @rzhao271 If we support example could we add a combobox renderer to the settings editor?

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionalityintellisense-configIntellisense configuration issuessettings-editorVS Code settings editor issues

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions