Files
Asher 14da71499f Set platform based on server (#32)
* Set platform based on server

Had to refactor a bit to ensure our values get set before VS Code tries
to use them.

* Pave the way for mnemonics on all platforms

* Fix context menus on Mac

* Fix a bunch of things on Mac including menu bar

* Set keybindings based on client's OS
2019-02-26 12:01:14 -06:00

26 lines
1.1 KiB
TypeScript

import * as os from "os";
import * as platform from "vs/base/common/platform";
// tslint:disable no-any to override const
// Use en instead of en-US since that's vscode default and it uses
// that to determine whether to output aliases which will be redundant.
if (platform.locale === "en-US") {
(platform as any).locale = "en";
}
if (platform.language === "en-US") {
(platform as any).language = "en";
}
// Use the server's platform instead of the client's. For example, this affects
// how VS Code handles paths (and more) because different platforms give
// different results. We'll have to counter for things that shouldn't change,
// like keybindings.
(platform as any).isLinux = os.platform() === "linux";
(platform as any).isWindows = os.platform() === "win32";
(platform as any).isMacintosh = os.platform() === "darwin";
// This is used for keybindings, and in one place to choose between \r\n and \n
// (which we change to use platform.isWindows instead).
(platform as any).OS = (platform.isMacintosh ? platform.OperatingSystem.Macintosh : (platform.isWindows ? platform.OperatingSystem.Windows : platform.OperatingSystem.Linux));