Skip to content

JavaScript JSON mode #23

Description

@stanislavprokopov

CodeMirror JavaScript mode supports additional configuration options, allowing to display json, json-ld and typescript (doc)

I need the JSON mode, not sure how this could be configured right now.

CodeMirror supports using mime types as mode values, and then it automatically maps to correct mode, setting application/json is internally replaced with json: true, mode: javascript but setting mime type in the plugin config does not works correctly as it tries to load a js file mode/application/json.js that actually is not there.

This could be fixed by using the same mode resolving logic that CodeMirror has - https://github.com/codemirror/codemirror5/blob/e84384b4210bc35300994de07c6333666f2a5c9e/src/modes.js#L20C1-L20C1 and https://github.com/codemirror/codemirror5/blob/e84384b4210bc35300994de07c6333666f2a5c9e/mode/javascript/javascript.js#L953

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions