From 95363a5b52f3bf73531ac76b00178fa79ca97661 Mon Sep 17 00:00:00 2001 From: Nate Sesti <33237525+sestinj@users.noreply.github.com> Date: Thu, 28 Sep 2023 01:02:52 -0700 Subject: Past input (#513) * feat: :construction: use ComboBox in place of UserInputContainer * feat: :construction: adding context to previous inputs steps * feat: :sparkles: preview context items on click * feat: :construction: more work on context items ui * style: :construction: working out the details of ctx item buttons * feat: :sparkles: getting the final details * fix: :bug: fix height of ctx items bar * fix: :bug: last couple of details * fix: :bug: pass model param through to hf inference api * fix: :loud_sound: better logging for timeout * feat: :sparkles: option to set the meilisearch url * fix: :bug: fix height of past inputs --- extension/react-app/src/util/index.ts | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'extension/react-app/src/util') diff --git a/extension/react-app/src/util/index.ts b/extension/react-app/src/util/index.ts index fd74044d..5a95be41 100644 --- a/extension/react-app/src/util/index.ts +++ b/extension/react-app/src/util/index.ts @@ -46,3 +46,57 @@ export function getFontSize(): number { const fontSize = localStorage.getItem("fontSize"); return fontSize ? parseInt(fontSize) : 13; } + +export function getMarkdownLanguageTagForFile(filepath: string): string { + const ext = filepath.split(".").pop(); + switch (ext) { + case "py": + return "python"; + case "js": + return "javascript"; + case "ts": + return "typescript"; + case "java": + return "java"; + case "go": + return "go"; + case "rb": + return "ruby"; + case "rs": + return "rust"; + case "c": + return "c"; + case "cpp": + return "cpp"; + case "cs": + return "csharp"; + case "php": + return "php"; + case "scala": + return "scala"; + case "swift": + return "swift"; + case "kt": + return "kotlin"; + case "md": + return "markdown"; + case "json": + return "json"; + case "html": + return "html"; + case "css": + return "css"; + case "sh": + return "shell"; + case "yaml": + return "yaml"; + case "toml": + return "toml"; + case "tex": + return "latex"; + case "sql": + return "sql"; + default: + return ""; + } +} -- cgit v1.2.3-70-g09d2