UNPKG

codemirror-json-schema

Version:

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

20 lines (19 loc) 800 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.json5SchemaHover = json5SchemaHover; const hover_1 = require("../features/hover"); const json5_1 = __importDefault(require("json5")); const constants_1 = require("../constants"); /** * Instantiates a JSONHover instance with the JSON5 mode * @group Codemirror Extensions */ function json5SchemaHover(options) { const hover = new hover_1.JSONHover(Object.assign(Object.assign({}, options), { parser: json5_1.default.parse, mode: constants_1.MODES.JSON5 })); return async function jsonDoHover(view, pos, side) { return hover.doHover(view, pos, side); }; }