Skip to content

code/editor/LanguageEditor

import { … } from 'zidane-ui/code/editor'ui/src/code/editor/LanguageEditor.tsx

Components#

LanguageEditorComponent#

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

TypeScript
function LanguageEditor(props: LanguageEditorProps): Element
Parameters
NameTypeDescription
propsLanguageEditorProps

See LanguageEditorProps.

Element
LanguageEditor props
NameTypeDescription
className?string

Extra classes on the root element.

docCodeDocument

The file's state from useCodeDocument.

languageEditorLanguage | 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).

pathstring

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.

sessionKeystring

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.

visibleboolean

Whether this editor is on screen; focus and ⌘F follow it.

ui/src/code/editor/LanguageEditor.tsx:65

Constants#

LANGUAGE_DEBOUNCE_MSConstant#

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

TypeScript
const LANGUAGE_DEBOUNCE_MS = 300

ui/src/code/editor/LanguageEditor.tsx:30

Interfaces#

LanguageEditorPropsInterface#

Props of LanguageEditor.

TypeScript
interface LanguageEditorProps
LanguageEditorProps properties
NameTypeDescription
className?string

Extra classes on the root element.

docCodeDocument

The file's state from useCodeDocument.

languageEditorLanguage | 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).

pathstring

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.

sessionKeystring

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.

visibleboolean

Whether this editor is on screen; focus and ⌘F follow it.

ui/src/code/editor/LanguageEditor.tsx:35