Great! This solves half of the problem, but how can I set “options” to the mode? You know, in CodeMirror 5 mode can be an object like {name: "javascript", json: true}). I think mimetype alone cannot specify these options.
Indeed. If this is just a single boolean as in your example, one could argue that this should be a separate MIME type which could then register its own CodeMirror language support (I think there already should be a JSON mime type though).
But if you do have a valid use case for a more complex mode customization we should consider exposing the language compartment as previously mentioned (in which case lets move this discussion to GitHub).