MCPcopy Index your code
hub / github.com/winfunc/opcode / getLanguage

Function getLanguage

src/components/ToolWidgets.tsx:408–448  ·  view source on GitHub ↗
(path?: string)

Source from the content-addressed store, hash-verified

406
407 // Extract file extension for syntax highlighting
408 const getLanguage = (path?: string) => {
409 if (!path) return "text";
410 const ext = path.split('.').pop()?.toLowerCase();
411 const languageMap: Record<string, string> = {
412 ts: "typescript",
413 tsx: "tsx",
414 js: "javascript",
415 jsx: "jsx",
416 py: "python",
417 rs: "rust",
418 go: "go",
419 java: "java",
420 cpp: "cpp",
421 c: "c",
422 cs: "csharp",
423 php: "php",
424 rb: "ruby",
425 swift: "swift",
426 kt: "kotlin",
427 scala: "scala",
428 sh: "bash",
429 bash: "bash",
430 zsh: "bash",
431 yaml: "yaml",
432 yml: "yaml",
433 json: "json",
434 xml: "xml",
435 html: "html",
436 css: "css",
437 scss: "scss",
438 sass: "sass",
439 less: "less",
440 sql: "sql",
441 md: "markdown",
442 toml: "ini",
443 ini: "ini",
444 dockerfile: "dockerfile",
445 makefile: "makefile"
446 };
447 return languageMap[ext || ""] || "text";
448 };
449
450 // Parse content to separate line numbers from code
451 const parseContent = (rawContent: string) => {

Callers 5

ReadResultWidgetFunction · 0.85
WriteWidgetFunction · 0.85
EditWidgetFunction · 0.85
EditResultWidgetFunction · 0.85
MultiEditWidgetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected