diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-07-15 15:06:32 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-07-15 15:06:32 -0700 |
commit | 45ee33f7fd84c0bc49d35d9d1a7a3a8e9f6addd7 (patch) | |
tree | da7d7898a63178a4d6da73dcb08722a9a358634a /extension/src/util | |
parent | 48e5c8001e897eb37493357087410ee8f98217fa (diff) | |
download | sncontinue-45ee33f7fd84c0bc49d35d9d1a7a3a8e9f6addd7.tar.gz sncontinue-45ee33f7fd84c0bc49d35d9d1a7a3a8e9f6addd7.tar.bz2 sncontinue-45ee33f7fd84c0bc49d35d9d1a7a3a8e9f6addd7.zip |
use correct label for meta key
Diffstat (limited to 'extension/src/util')
-rw-r--r-- | extension/src/util/util.ts | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/extension/src/util/util.ts b/extension/src/util/util.ts index d33593e1..dfc10c90 100644 --- a/extension/src/util/util.ts +++ b/extension/src/util/util.ts @@ -1,5 +1,6 @@ import { RangeInFile, SerializedDebugContext } from "../client"; import * as fs from "fs"; +const os = require("os"); function charIsEscapedAtIndex(index: number, str: string): boolean { if (index === 0) return false; @@ -113,3 +114,31 @@ export function debounced(delay: number, fn: Function) { }, delay); }; } + +type Platform = "mac" | "linux" | "windows" | "unknown"; + +function getPlatform(): Platform { + const platform = os.platform(); + if (platform === "darwin") { + return "mac"; + } else if (platform === "linux") { + return "linux"; + } else if (platform === "win32") { + return "windows"; + } else { + return "unknown"; + } +} + +export function getMetaKeyLabel() { + const platform = getPlatform(); + switch (platform) { + case "mac": + return "⌘"; + case "linux": + case "windows": + return "^"; + default: + return "⌘"; + } +} |