codemirror-json-schema
Version:
Codemirror 6 extensions that provide full JSONSchema support for `@codemirror/lang-json` and `codemirror-json5`
14 lines (13 loc) • 480 B
JavaScript
import { JSONHover } from "../features/hover";
import YAML from "yaml";
import { MODES } from "../constants";
/**
* Instantiates a JSONHover instance with the YAML mode
* @group Codemirror Extensions
*/
export function yamlSchemaHover(options) {
const hover = new JSONHover(Object.assign(Object.assign({}, options), { parser: YAML.parse, mode: MODES.YAML }));
return async function jsonDoHover(view, pos, side) {
return hover.doHover(view, pos, side);
};
}