Skip to content

v0.5.0

Compare
Choose a tag to compare
@github-actions github-actions released this 08 Nov 05:52
· 17 commits to main since this release

Minor Changes

  • #63 a73c517 Thanks @acao! - breaking change: only impacts those following the "custom usage" approach, it does not effect users using the high level, "bundled" jsonSchema() or json5Schema() modes.

    Previously, we ask you to pass schema to each of the linter, completion and hover extensions.

    Now, we ask you to use these new exports to instantiate your schema like this, with stateExtensions(schema) as a new extension, and the only one that you pass schema to, like so:

    import type { JSONSchema7 } from "json-schema";
    import { json, jsonLanguage, jsonParseLinter } from "@codemirror/lang-json";
    import { hoverTooltip } from "@codemirror/view";
    import { linter } from "@codemirror/lint";
    
    import {
      jsonCompletion,
      handleRefresh,
      jsonSchemaLinter,
      jsonSchemaHover,
      stateExtensions,
    } from "codemirror-json-schema";
    
    import schema from "./myschema.json";
    
    // ...
    extensions: [
      json(),
      linter(jsonParseLinter()),
      linter(jsonSchemaLinter(), {
        needsRefresh: handleRefresh,
      }),
      jsonLanguage.data.of({
        autocomplete: jsonCompletion(),
      }),
      hoverTooltip(jsonSchemaHover()),
      // this is where we pass the schema!
      // very important!!!!
      stateExtensions(schema),
    ];