# All files / src/lib monaco-config.ts

100% Statements 44/44
100% Branches 4/4
100% Functions 2/2
100% Lines 44/44

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
    451x
    1x
    1x
    1x
    1x
    1x
    4x
    4x
    4x
    2x
    2x
    2x
    4x
    1x
    1x
    1x
    1x
    1x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
    24x
     import type { Monaco } from '@monaco-editor/react'

    /**
     * Configure TypeScript support in Monaco Editor
     */
    export function configureMonacoTypeScript(monaco: Monaco) {
      // TypeScript is automatically supported by Monaco
      // This function can be used for additional configuration if needed
      if (monaco.languages.typescript) {
        // Configure TypeScript defaults if needed
        monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true)
      }
    }

    /**
     * Map language names to Monaco Editor language IDs
     */
    export function getMonacoLanguage(language: string): string {
      const languageMap: Record<string, string> = {
        'JavaScript': 'javascript',
        'TypeScript': 'typescript',
        'JSX': 'javascript',
        'TSX': 'typescript',
        'Python': 'python',
        'Java': 'java',
        'C++': 'cpp',
        'C#': 'csharp',
        'Go': 'go',
        'Rust': 'rust',
        'PHP': 'php',
        'Ruby': 'ruby',
        'SQL': 'sql',
        'HTML': 'html',
        'CSS': 'css',
        'JSON': 'json',
        'YAML': 'yaml',
        'Markdown': 'markdown',
        'XML': 'xml',
        'Shell': 'shell',
        'Bash': 'shell',
      }

      return languageMap[language] || language.toLowerCase()
    }