()
| 317 | } |
| 318 | |
| 319 | export default function Editor(): JSX.Element { |
| 320 | const store = useStore(); |
| 321 | const deferredStore = useDeferredValue(store); |
| 322 | const [compilerOutput, language, appliedOptions] = useMemo( |
| 323 | () => compile(deferredStore.source, 'compiler', deferredStore.config), |
| 324 | [deferredStore.source, deferredStore.config], |
| 325 | ); |
| 326 | const [linterOutput] = useMemo( |
| 327 | () => compile(deferredStore.source, 'linter', deferredStore.config), |
| 328 | [deferredStore.source, deferredStore.config], |
| 329 | ); |
| 330 | |
| 331 | let mergedOutput: CompilerOutput; |
| 332 | let errors: Array<CompilerErrorDetail | CompilerDiagnostic>; |
| 333 | if (compilerOutput.kind === 'ok') { |
| 334 | errors = linterOutput.kind === 'ok' ? [] : linterOutput.error.details; |
| 335 | mergedOutput = { |
| 336 | ...compilerOutput, |
| 337 | errors, |
| 338 | }; |
| 339 | } else { |
| 340 | mergedOutput = compilerOutput; |
| 341 | errors = compilerOutput.error.details; |
| 342 | } |
| 343 | return ( |
| 344 | <> |
| 345 | <div className="relative flex top-14"> |
| 346 | <div className="flex-shrink-0"> |
| 347 | <ConfigEditor appliedOptions={appliedOptions} /> |
| 348 | </div> |
| 349 | <div className="flex flex-1 min-w-0"> |
| 350 | <Input language={language} errors={errors} /> |
| 351 | <Output store={deferredStore} compilerOutput={mergedOutput} /> |
| 352 | </div> |
| 353 | </div> |
| 354 | </> |
| 355 | ); |
| 356 | } |
nothing calls this directly
no test coverage detected