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
This commit is contained in:
@@ -1,12 +1,25 @@
|
||||
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") {
|
||||
// tslint:disable-next-line no-any to override const
|
||||
(platform as any).locale = "en";
|
||||
}
|
||||
if (platform.language === "en-US") {
|
||||
// tslint:disable-next-line no-any to override const
|
||||
(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));
|
||||
|
||||
Reference in New Issue
Block a user