diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-07-16 16:25:02 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-07-16 16:25:02 -0700 |
commit | 4c3a25a1c8938f8132233e021c74d98eb19d7ddd (patch) | |
tree | 8460e5703f224e7ef5c2c7eca6b470f338b93e1e /extension/src/util/util.ts | |
parent | 3ded151331933c9a1352cc46c3cc67c5733d1c86 (diff) | |
parent | a4a815628f702af806603015ec6805edd151328b (diff) | |
download | sncontinue-4c3a25a1c8938f8132233e021c74d98eb19d7ddd.tar.gz sncontinue-4c3a25a1c8938f8132233e021c74d98eb19d7ddd.tar.bz2 sncontinue-4c3a25a1c8938f8132233e021c74d98eb19d7ddd.zip |
Merge branch 'main' into ggml-server
Diffstat (limited to 'extension/src/util/util.ts')
-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 "⌘"; + } +} |