Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

794 B
Raw Blame
import {
  highlightMobileCode,
  resolveMobileSyntaxLanguage,
  type MobileSyntaxSegment
} from '../session/mobile-file-syntax'

export type MobileFilePreviewSyntax = {
  language: string
  segments: MobileSyntaxSegment[]
}

export function buildMobileFilePreviewSyntax(
  relativePath: string,
  content: string
): MobileFilePreviewSyntax {
  try {
    const language = resolveMobileSyntaxLanguage(relativePath)
    const result = highlightMobileCode(content, language)
    return {
      language,
      segments: result.segments.length > 0 ? result.segments : plainSegments(content)
    }
  } catch {
    return { language: 'plaintext', segments: plainSegments(content) }
  }
}

function plainSegments(content: string): MobileSyntaxSegment[] {
  return [{ kind: 'plain', text: content }]
}