# code/editor/LanguageEditor (zidane-ui/code/editor)

Import: `import { … } from 'zidane-ui/code/editor'`. Source: [ui/src/code/editor/LanguageEditor.tsx](https://github.com/Tahul/zidane/blob/main/ui/src/code/editor/LanguageEditor.tsx).

## Components

### `LanguageEditor`

Component.

A `CodeEditor` wired to a language service; see the module comment.

```ts
function LanguageEditor(props: LanguageEditorProps): Element
```

**Parameters**

- `props` (`LanguageEditorProps`): See [`LanguageEditorProps`](https://zidane.si/docs/reference/ui-code-editor-language-editor.md#LanguageEditorProps).

**Returns** `Element`

**Props**

- `className?` (`string`): Extra classes on the root element.
- `doc` (`CodeDocument`): The file's state from `useCodeDocument`.
- `language` (`EditorLanguage | null`): The service for this file; `null`: a plain `CodeEditor` with no findings, hovers or navigation.
- `onDiagnostics?` (`(path: string, items: readonly EditorDiagnostic[] | null) => void`): The file's findings changed (`null`: a check runs).
- `onNavigate?` (`(target: EditorLocation) => void`): Open a file at a position (a definition, a reference).
- `path` (`string`): The file's path; the language service and navigation targets know it by this.
- `readOnly?` (`boolean`): Never arm the editor.
- `reveal?` (`EditorReveal | null`): Where to go in this file, once per nonce.
- `sessionKey` (`string`): pierre's retained-session key (the draft and undo stack survive remounts under it).
- `style?` (`CSSProperties`): Inline styles on the root element, merged after the component's own.
- `visible` (`boolean`): Whether this editor is on screen; focus and ⌘F follow it.

Source: [ui/src/code/editor/LanguageEditor.tsx:65](https://github.com/Tahul/zidane/blob/main/ui/src/code/editor/LanguageEditor.tsx#L65)

## Constants

### `LANGUAGE_DEBOUNCE_MS`

Constant.

Edits are sent this long after the last keystroke, like the app's language servers.

```ts
const LANGUAGE_DEBOUNCE_MS = 300
```

Source: [ui/src/code/editor/LanguageEditor.tsx:30](https://github.com/Tahul/zidane/blob/main/ui/src/code/editor/LanguageEditor.tsx#L30)

## Interfaces

### `LanguageEditorProps`

Interface.

Props of [`LanguageEditor`](https://zidane.si/docs/reference/ui-code-editor-language-editor.md#LanguageEditor).

```ts
interface LanguageEditorProps
```

**Properties**

- `className?` (`string`): Extra classes on the root element.
- `doc` (`CodeDocument`): The file's state from `useCodeDocument`.
- `language` (`EditorLanguage | null`): The service for this file; `null`: a plain `CodeEditor` with no findings, hovers or navigation.
- `onDiagnostics?` (`(path: string, items: readonly EditorDiagnostic[] | null) => void`): The file's findings changed (`null`: a check runs).
- `onNavigate?` (`(target: EditorLocation) => void`): Open a file at a position (a definition, a reference).
- `path` (`string`): The file's path; the language service and navigation targets know it by this.
- `readOnly?` (`boolean`): Never arm the editor.
- `reveal?` (`EditorReveal | null`): Where to go in this file, once per nonce.
- `sessionKey` (`string`): pierre's retained-session key (the draft and undo stack survive remounts under it).
- `style?` (`CSSProperties`): Inline styles on the root element, merged after the component's own.
- `visible` (`boolean`): Whether this editor is on screen; focus and ⌘F follow it.

Source: [ui/src/code/editor/LanguageEditor.tsx:35](https://github.com/Tahul/zidane/blob/main/ui/src/code/editor/LanguageEditor.tsx#L35)
