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

0% Statements 0/44
0% Branches 0/1
0% Functions 0/1
0% Lines 0/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
    45

     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()
    }