Permalink
Browse files

Fix Microsoft#35361: fix native tabs on macOS 10.13

macOS 10.13 mistakenly enables a compatibility option on VS Code
and VS Code Insiders because their bundle IDs begin with
"com.microsoft.". This breaks native tabs.

Explicitly disable the compatibility patch using NSUserDefaults.

Note that Code-OSS is not affected by the bug, since its bundle ID
is "com.visualstudio.code.oss". To test this behaviour, change
darwinBundleIdentifier in product.json.
  • Loading branch information...
zhuowei committed Jun 24, 2018
1 parent d5ad357 commit a7989f0a648af0b91dc0cea7c9cebe2f4f230654
Showing with 11 additions and 1 deletion.
  1. +11 −1 src/vs/code/electron-main/app.ts
@@ -5,7 +5,7 @@

'use strict';

import { app, ipcMain as ipc } from 'electron';
import { app, ipcMain as ipc, systemPreferences } from 'electron';
import * as platform from 'vs/base/common/platform';
import { WindowsManager } from 'vs/code/electron-main/windows';
import { IWindowsService, OpenContext, ActiveWindowManager } from 'vs/platform/windows/common/windows';
@@ -274,6 +274,16 @@ export class CodeApplication {
app.setAppUserModelId(product.win32AppUserModelId);
}

// Fix native tabs on macOS 10.13
// macOS enables a compatibility patch for any bundle ID beginning with
// "com.microsoft.", which breaks native tabs for VS Code.
// Explicitly opt out of the patch here before creating any windows.
// https://github.com/Microsoft/vscode/issues/35361#issuecomment-399794085

if (platform.isMacintosh) {
systemPreferences.registerDefaults({ NSUseImprovedLayoutPass: true });
}

// Create Electron IPC Server
this.electronIpcServer = new ElectronIPCServer();

0 comments on commit a7989f0

Please sign in to comment.