UNPKG

codemirror-json-schema

Version:

Codemirror 6 extensions that provide full JSONSchema support for `@codemirror/lang-json` and `codemirror-json5`

14 lines (13 loc) 486 B
import { JSONHover } from "../features/hover"; import json5 from "json5"; import { MODES } from "../constants"; /** * Instantiates a JSONHover instance with the JSON5 mode * @group Codemirror Extensions */ export function json5SchemaHover(options) { const hover = new JSONHover(Object.assign(Object.assign({}, options), { parser: json5.parse, mode: MODES.JSON5 })); return async function jsonDoHover(view, pos, side) { return hover.doHover(view, pos, side); }; }