/**
 * JavaScript & TypeScript language support for CodeMirror 6
 * Wraps @codemirror/lang-javascript
 */

import { javascript as cmJavascript } from '@codemirror/lang-javascript'
import { type LanguageSupport } from '@codemirror/language'

/** JavaScript language support for CodeMirror */
export function javascript(): LanguageSupport {
  return cmJavascript()
}

/** TypeScript language support for CodeMirror (JSX + TS enabled) */
export function typescript(): LanguageSupport {
  return cmJavascript({ typescript: true, jsx: true })
}
