MCPcopy
hub / github.com/opentrace/opentrace / detectLanguage

Function detectLanguage

ui/src/appComponents/NodeDetailsPanel.tsx:138–146  ·  view source on GitHub ↗

Resolve a Prism language from the source response or file path.

(source: NodeSourceResponse)

Source from the content-addressed store, hash-verified

136
137/** Resolve a Prism language from the source response or file path. */
138function detectLanguage(source: NodeSourceResponse): string {
139 if (source.language) {
140 const lower = source.language.toLowerCase();
141 // Already a prism name or in our map
142 return EXT_TO_LANG[lower] ?? lower;
143 }
144 const ext = source.path.split('.').pop()?.toLowerCase() ?? '';
145 return EXT_TO_LANG[ext] ?? 'plaintext';
146}
147
148export interface NodeEdge {
149 label: string;

Callers 1

NodeDetailsPanelFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected