MCPcopy Create free account
hub / github.com/AlexErrant/Pentive / createEditorState

Function createEditorState

app/src/components/editSetting.tsx:131–157  ·  view source on GitHub ↗
(
	doc: string,
	theme: 'light' | 'dark',
	schema: JSONSchema7,
)

Source from the content-addressed store, hash-verified

129} satisfies JSONSchema7
130
131function createEditorState(
132 doc: string,
133 theme: 'light' | 'dark',
134 schema: JSONSchema7,
135) {
136 const maybeDark = theme === 'dark' ? [oneDark] : []
137 return EditorState.create({
138 doc,
139 extensions: [
140 [...basicSetup],
141 json(),
142 ...maybeDark,
143 lintGutter(),
144 linter(jsonParseLinter(), {
145 delay: 300,
146 }),
147 linter(jsonSchemaLinter(), {
148 needsRefresh: handleRefresh,
149 }),
150 jsonLanguage.data.of({
151 autocomplete: jsonCompletion(),
152 }),
153 hoverTooltip(jsonSchemaHover()),
154 stateExtensions(schema),
155 ],
156 })
157}

Callers 1

EditSettingFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected