Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | const extensionToLanguage: { [key: string]: string } = {
// Web technologies
html: "html",
htm: "html",
css: "css",
js: "javascript",
jsx: "jsx",
ts: "typescript",
tsx: "tsx",
// Backend languages
py: "python",
rb: "ruby",
php: "php",
java: "java",
cs: "csharp",
go: "go",
rs: "rust",
scala: "scala",
kt: "kotlin",
swift: "swift",
// Markup and data
json: "json",
xml: "xml",
yaml: "yaml",
yml: "yaml",
md: "markdown",
csv: "csv",
// Shell and scripting
sh: "bash",
bash: "bash",
zsh: "bash",
ps1: "powershell",
// Configuration
toml: "toml",
ini: "ini",
cfg: "ini",
conf: "ini",
// Other
sql: "sql",
graphql: "graphql",
gql: "graphql",
tex: "latex",
svg: "svg",
txt: "text",
// C-family languages
c: "c",
cpp: "cpp",
h: "c",
hpp: "cpp",
// Functional languages
hs: "haskell",
lhs: "haskell",
elm: "elm",
clj: "clojure",
cljs: "clojure",
erl: "erlang",
ex: "elixir",
exs: "elixir",
// Mobile development
dart: "dart",
m: "objectivec",
mm: "objectivec",
// Game development
lua: "lua",
gd: "gdscript", // Godot
unity: "csharp", // Unity (using C#)
// Data science and ML
r: "r",
jl: "julia",
ipynb: "jupyter", // Jupyter notebooks
}
// Example usage:
// console.log(getLanguageFromPath('/path/to/file.js')); // Output: javascript
export function getLanguageFromPath(path: string): string | undefined {
const extension = path.split(".").pop()?.toLowerCase() || ""
return extensionToLanguage[extension]
}
|