I noticed something "strange" today while working with a VS Code on a new Mac.
The default font size, in pixels, of VS Code in macOS is set to 12. I gave a look to my Windows and Linux machines and I noticed that they have a default font size of 14. Does anybody know why there is such a difference between default font sizes based on the Operating System?
I did a few researches and I notice that the display size does not matter. Any Mac (13', 14', 16'...) will have a 12 default font size on VS Code, while any Windows/Linux machine will have 14.
I'm not asking how to change font size on VS Code, this can obviously be looked at with a google research, I would like to know why there is such a discrepancy between Operating Systems, as I was not able to find anything online.
That's how it is because that's how the maintainers of VS Code wrote it to be. As for why they wrote it that way, I have no idea.
If you look in src/vs/editor/common/config/editorOptions.ts, you'll see (at least at the time of this writing):
/**
* @internal
*/
export const EDITOR_FONT_DEFAULTS = {
fontFamily: (
platform.isMacintosh ? DEFAULT_MAC_FONT_FAMILY : (platform.isLinux ? DEFAULT_LINUX_FONT_FAMILY : DEFAULT_WINDOWS_FONT_FAMILY)
),
fontWeight: 'normal',
fontSize: (
platform.isMacintosh ? 12 : 14
),
lineHeight: 0,
letterSpacing: 0,
};
Here's a link to the specific line for the latest version of this file at the time of this writing: https://github.com/microsoft/vscode/blob/e1c4a6d7bb4dbd5eeb8332b970d7b934fb325649/src/vs/editor/common/config/editorOptions.ts#L4757.
Before ed52cdd
: "Move default option values to editorOptions.ts", the default was stored here in src/vs/editor/common/config/defaultConfig.ts. If you view the git blame for that commit, you'll see that the commit that last changed that line prior to that commit contained a bunch of other changes for Set editor font in a such a way that it doesn't need to be reset by widgets (e.g. find widget) #5972, but I can't tell how that change is related to that issue ticket.
I think that's as far as my simple detective work can go. To get any further in understanding the history, you'd probably need to actually talk to the developers who made those changes.
For the interactive session API (not really sure what that is to be honest):
If you look in VS Code's source code in src/vs/workbench/contrib/interactiveSession/browser/interactiveSession.contribution.ts, you'll see (at least at the time of this writing):
// Register configuration
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
configurationRegistry.registerConfiguration({
id: 'interactiveSessionSidebar',
title: nls.localize('interactiveSessionConfigurationTitle', "Interactive Session"),
type: 'object',
properties: {
'interactiveSession.editor.fontSize': {
type: 'number',
description: nls.localize('interactiveSession.editor.fontSize', "Controls the font size in pixels in Interactive Sessions."),
default: isMacintosh ? 12 : 14,
},
...
}
});
Here's a link to the specific line for the latest version of the file at the time of this writing: https://github.com/microsoft/vscode/blob/c83f54aefc2dd212c01a42c57c930aa8a13af3a6/src/vs/workbench/contrib/interactiveSession/browser/interactiveSession.contribution.ts#L41.